0

I've got a C++ project in Embarcadero RAD Studio 10.1 Berlin. The project is setup to use Direct2D. Canvas drawing works just fine with the TDirect2DCanvas class. Everything renders smoothly. However, I need to use render targets. I am getting a linking error when I try to do this. For example, when I try this:

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

I get the following linking error:

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

I thought C++Builder was supposed to already be setup to link against Direct2D if I just included the headers. Can anyone help me link against the appropriate files?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Please [edit] your question title so it contains something meaningful. Direct2D and C++Builder are both available from the tags you've added, and Embarcadero is irrelevant (unless you know of another company who owns C++ Builder currently). Removing those from your title leaves *in*, which clearly has no meaning alone. Your title should describe the problem you're having or question you're asking in a way that will be relevant to future readers here who see it in a search result. – Ken White Jun 22 '16 at 22:08
  • I've updated my post. –  Jun 23 '16 at 01:37
  • 1
    Maybe we should mark every question as duplicate as they are all related to coding? That would certainly keep stackoverflow neat and tidy :). Yes, you do need to link to d2d1.lib, this is mentioned somewhere in the Help. Keep in mind even after all these years, BCB still only supports D2D 1.0... – Mike Versteeg Jun 23 '16 at 06:38
  • Per the [`D2D1MakeRotateMatrix()` documentation](https://msdn.microsoft.com/en-us/library/windows/desktop/dd368049.aspx), it is implemented in `D2d1.dll` and referenced by `D2d1.lib`, so make sure you are linking in `D2d1.lib` to your executable, either by adding the `.lib` file to your project (it is located in the `$(BDS)\lib\win32\release\psdk` folder), or by adding a `#pragma comment(lib, "D2d1.lib")` statement in your code (and make sure the PSDK folder is in your project's library search path). – Remy Lebeau Mar 31 '17 at 21:55

0 Answers0