Author Topic: Problem compěling after r11701 (related to Direct2D)  (Read 224 times)

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 253
Problem compěling after r11701 (related to Direct2D)
« on: May 19, 2019, 01:57:33 pm »
After updating to r11701 I can't compile C::B due to this lines in PlatWX.cpp

Code: [Select]
#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)
    #error "You need to have Direct2D capable wxWidget build to build Code::Blocks. We want to support fonts with ligatures!!!"
#endif // wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)

I have changed wxUSE_GRAPHICS_GDIPLUS to 0 and wxUSE_GRAPHICS_DIRECT2D to 1 in my setup.h and recompiled wx3.1.2, but now I get linking errors when creating libwxscintilla.a:

Code: [Select]
undefined reference to wxGCDC::AcquireHDC()
undefined reference to wxGraphicsRenderer::GetDefaultRenderer()

and more like those. Which configuration should I use to get this to work?.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11715
    • Travis build status
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #1 on: May 19, 2019, 03:19:43 pm »
Why do you disable wxUSE_GRAPHICS_GDIPLUS?

Unfortunately I don't remember what I did to enable direct2d. :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 253
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #2 on: May 19, 2019, 03:46:49 pm »
In a first step I only changed wxUSE_GRAPHICS_DIRECT2D to 1; wxWidgets compiled OK, but when linking C::B sdk the linker does not find the Direct2D functions.

I then read that Direct2D was intended to replace GDI+, so I disabled GDI+ just in case it was blocking Direct2D. This breaks libwxscntilla.a creation.

So I prefer asking before recompiling wxWidgets for a third time.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6507
    • My Best Post
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #3 on: May 19, 2019, 03:55:00 pm »
Operating System version?
wxWidgets version? 3.1.2

What happen to make you think it failed to find Direct2D functions?
Build error or what?

Tim S.

« Last Edit: May 19, 2019, 03:56:59 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 253
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #4 on: May 19, 2019, 04:02:58 pm »
Windows 10 64 bits
MinGW 7.2
wxWidgets 3.1.2 compiled in 32 bits

When I set wxUSE_GRAPHICS_DIRECT2D to 1 wxWidgets compiles OK, but when linking C::B sdk the linker does not find the Direct2D functions. I am now on a different computer, don't have the exact error messages at hand.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11715
    • Travis build status
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #5 on: May 19, 2019, 05:23:16 pm »
Can you build the stc sample and see if it works? There is a chance your compiler (mingw stuff in fact) has missing all the direct2d libs which are required. I think, I'm using mingw-w64 8.x.x.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sodev

  • Regular
  • ***
  • Posts: 255
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #6 on: May 19, 2019, 11:21:02 pm »
I am using MSVC and i get GDI+ and Direct 2D out-of-the-box without any special setup. I remember in the past even GDI+ wasn't working on MinGW so this might indeed be a compiler issue. You can check setup.h, it should contain #ifdefs for these features to test the compiler version, might give you a hint which version is required.

Thats one of the reasons why i don't like to use GCC on Windows ;)

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 253
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #7 on: Yesterday at 10:20:20 am »
Ok, updating to mingw-w64 with GCC 8.1 did the trick.

Quote
I am using MSVC and i get GDI+ and Direct 2D out-of-the-box without any special setup

MSVC has Direct2D activated by default, when using GCC you must activate it explicitly. This is the original setup.h code:

Code: [Select]
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D 0
#endif

I don't use any MS product (apart from Windows, of course).

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5218
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #8 on: Yesterday at 04:48:04 pm »
Do you mean that I have to use MinGW-w64's gcc 8.1 and above?
I have only gcc 7.2 at hand.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6507
    • My Best Post
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #9 on: Yesterday at 06:35:21 pm »
The problem was likely an missing header in mingw.org GCC; mingw-w64 has several headers that are not in mingw.org GCC.

Do you mean that I have to use MinGW-w64's gcc 8.1 and above?
I have only gcc 7.2 at hand.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11715
    • Travis build status
Re: Problem compěling after r11701 (related to Direct2D)
« Reply #10 on: Yesterday at 10:31:13 pm »
Do you mean that I have to use MinGW-w64's gcc 8.1 and above?
I have only gcc 7.2 at hand.
You have to use a compiler which has the direct2d headers/libs or you have to manually comment the enforcing code in local builds.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]