2016-06-23 17 views
1

Ich habe ein C++ Builder (Rad Studio Berlin) Projekt eingerichtet, um Direct2d zu verwenden. Canvas-Zeichnung funktioniert gut mit dem TDirect2DCanvas, was darauf hinweisen würde, dass Direct2D korrekt verlinkt ist. Alles macht glatt. Ich muss jedoch eine Matrix verwenden. Ich bekomme einen Verknüpfungsfehler, wenn ich versuche. Zum Beispiel, wenn ich versuche:Direct2D nur teilweises Verknüpfen in C++ Builder

canvas->RenderTarget->SetTransform(D2D1::Matrix3x2F::Rotation(15.0, D2D1PointF(100, 100))); 

... ich die folgende Verknüpfung Fehlermeldung erhalten:

[ilink32 Error] Error: Unresolved external 'D2D1MakeRotateMatrix' referenced from C:\DP\TRUNK\SRC\CLIENTSIDE\APPLICATIONS\VIEWER\WIN32\DEBUG\MIMAGE.OBJ 

C++ Builder sollte bereits eingerichtet sein, gegen Direct2D zu verknüpfen, wenn ich schließe nur die Header. Kann mir jemand helfen, mit den entsprechenden Dateien auf C++ Builder-Art zu verlinken?

Antwort

0

Ich fand die Lösung aus einer anderen Quelle. Hier ist es:

Nach einigen Untersuchungen wurde dieses Problem nicht als ein Fehler festgestellt.

For many of the standard Windows API functions, the IDE will add the correct library automatically so that the dependencies on the function references will be satisfied. With DirectX (which is somewhat uncommonly used), the IDE does not automatically supply the library which corresponds to the header file, so this is causing the unresolved linker errors.

The solution is to either (as I mentioned previously) add the D2D1.lib to the project, or statically reference it in code:

// as long as D2D1.lib is on the library search path, it should be found 
#pragma comment(lib,"D2D1.lib") 

Some developers add the above line of code to their headers and so all you need to do is include the header and all is well... the DirectX team did not do this and hence the unresolved linker errors.

Hope this klärt die Frage,

Verwandte Themen