Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Miguel Gimenez on May 19, 2019, 01:57:33 pm

Title: Problem compìling after r11701 (related to Direct2D)
Post by: Miguel Gimenez 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
#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
undefined reference to wxGCDC::AcquireHDC()
undefined reference to wxGraphicsRenderer::GetDefaultRenderer()

and more like those. Which configuration should I use to get this to work?.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: oBFusCATed 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. :(
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Miguel Gimenez 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.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: stahta01 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.

Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Miguel Gimenez 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.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: oBFusCATed 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.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: sodev 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 ;)
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Miguel Gimenez on May 20, 2019, 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
#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).
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: ollydbg on May 20, 2019, 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.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: stahta01 on May 20, 2019, 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.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: oBFusCATed on May 20, 2019, 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.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Pecan on May 24, 2019, 09:22:57 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.

I'm using mingw810_64seh> gcc.exe --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0

Could you please tell us what we have to do to get around this problem.
I don't understand the comment above. What does "comment the enforcing code" mean? And where would that be?

The setup.h for wxWidgets 3.1.1 here is:
Code
// Enable wxGraphicsContext and related classes for a modern 2D drawing API.
//
// Default is 1 except if you're using a compiler without support for GDI+
// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are
// known to have them). For other compilers (e.g. older mingw32) you may need
// to install the headers (and just the headers) yourself. If you do, change
// the setting below manually.
//
// Recommended setting: 1 if supported by the compilation environment

// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION()
// here as this file is included from wx/platform.h before they're defined.
#if defined(_MSC_VER) || \
    (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8))
#define wxUSE_GRAPHICS_CONTEXT 1
#else
// Disable support for other Windows compilers, enable it if your compiler
// comes with new enough SDK or you installed the headers manually.
//
// Notice that this will be set by configure under non-Windows platforms
// anyhow so the value there is not important.
#define wxUSE_GRAPHICS_CONTEXT 0
#endif


...further down....

/* --- end common options --- */

/* --- start MSW options --- */
// ----------------------------------------------------------------------------
// Graphics backends choices for Windows
// ----------------------------------------------------------------------------

// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1.

// Enable support for GDI+-based implementation of wxGraphicsContext.
//
// Default is 1.
//
// Recommended setting: 1 if you need to support XP, as Direct2D is not
// available there.
#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT

// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D 0
#endif
 

But I still get the problem.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: stahta01 on May 24, 2019, 10:13:02 pm
Code
#define wxUSE_GRAPHICS_DIRECT2D 0
The above likely needs to
Code
#define wxUSE_GRAPHICS_DIRECT2D 1

Tim S.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Pecan on May 24, 2019, 10:27:41 pm
The error is caused by the line 34 in PlatWX.cpp
Code
#if defined(__WXMSW__) && wxUSE_GRAPHICS_DIRECT2D

adding "defined()" around  wxUSE_GRAPHICS_DIRECT2D solves this problem and  gets me further.
eg.
Code
#if defined(__WXMSW__) && defined(wxUSE_GRAPHICS_DIRECT2D)

Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Pecan on May 24, 2019, 10:39:19 pm
Now I'm getting pummeled with errors from PlatWx that I don't understand:

Code
||=== Build: scintilla in Code::Blocks wx3.1.x (64 bit) (compiler: GNU GCC Compiler) ===|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In member function 'virtual void Font::Create(const FontParameters&)':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|203|error: expected type-specifier before 'SurfaceFontDataD2D'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|782|error: 'SurfaceFontDataD2D' does not name a type; did you mean 'SurfaceData'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|869|error: 'SurfaceFontDataD2D' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|869|error: non-member function 'bool Initialised()' cannot have cv-qualifier|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In function 'bool Initialised()':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|871|error: 'm_pTextFormat' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|871|note: suggested alternative: 'GetTimeFormat'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|877|error: 'SurfaceDataD2D' does not name a type; did you mean 'SurfaceData'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|911|error: 'SurfaceDataD2D' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|911|error: non-member function 'bool Initialised()' cannot have cv-qualifier|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|911|error: redefinition of 'bool Initialised()'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|869|note: 'bool Initialised()' previously defined here|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In function 'bool Initialised()':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|913|error: 'm_pD2DFactory' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|913|note: suggested alternative: 'wxDCFactory'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|913|error: 'm_pDWriteFactory' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|913|note: suggested alternative: 'IID_ITypeFactory'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|916|error: 'SurfaceDataD2D' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In function 'void DiscardGraphicsResources()':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|918|error: 'm_pRenderTarget' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|919|error: 'm_pSolidBrush' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|919|note: suggested alternative: 'CreateSolidBrush'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|920|error: 'm_pPatternBrush' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|920|note: suggested alternative: 'CreatePatternBrush'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|923|error: 'SurfaceDataD2D' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In function 'HRESULT CreateGraphicsResources()':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|926|error: 'm_pRenderTarget' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|928|error: 'D2D1_RENDER_TARGET_PROPERTIES' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|934|error: 'm_pD2DFactory' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|934|note: suggested alternative: 'wxDCFactory'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|935|error: 'renderTargetProperties' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|935|note: suggested alternative: 'PrinterProperties'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|940|error: 'D2D1_COLOR_F' does not name a type; did you mean 'DM_COLOR'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|941|error: 'color' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|941|error: 'm_pSolidBrush' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|941|note: suggested alternative: 'CreateSolidBrush'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|946|error: 'D2D1_BITMAP_BRUSH_PROPERTIES' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|951|error: 'wxCOMPtr' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|951|note: suggested alternative: 'wxCOPY'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|951|error: 'ID2D1Bitmap' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|951|note: suggested alternative: 'LoadBitmap'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|951|error: 'bitmap' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|951|note: suggested alternative: 'wxBitmap'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|953|error: 'D2D1_PIXEL_FORMAT' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|953|note: suggested alternative: 'EMR_PIXELFORMAT'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|958|error: 'D2D1' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|959|error: 'D2D1' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|959|error: 'pixel_format' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|959|note: suggested alternative: 'wxPixelFormat'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|962|error: 'brushProperties' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|962|note: suggested alternative: 'EdgeProperties'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|963|error: 'm_pPatternBrush' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|963|note: suggested alternative: 'CreatePatternBrush'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|969|error: 'SurfaceDataD2D' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In function 'void SetEditorPaintAbandoned()':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|971|error: 'm_editor' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|971|note: suggested alternative: 'Editor'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1066|error: 'wxCOMPtr' does not name a type; did you mean 'wxCOPY'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1067|error: 'wxCOMPtr' does not name a type; did you mean 'wxCOPY'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1068|error: 'wxCOMPtr' does not name a type; did you mean 'wxCOPY'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1069|error: 'wxCOMPtr' does not name a type; did you mean 'wxCOPY'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1070|error: 'wxCOMPtr' does not name a type; did you mean 'wxCOPY'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1072|error: 'SurfaceDataD2D' does not name a type; did you mean 'SurfaceData'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In constructor 'SurfaceD2D::SurfaceD2D()':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1077|error: class 'SurfaceD2D' does not have any field named 'm_pDWriteFactory'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1077|error: '::wxDWriteFactory' has not been declared|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1077|note: suggested alternative: 'wxDCFactory'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1092|error: 'm_surfaceData' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1092|note: suggested alternative: 'SurfaceData'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp||In member function 'virtual void SurfaceD2D::Init(SurfaceID, WindowID)':|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|error: 'm_surfaceData' was not declared in this scope|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|note: suggested alternative: 'SurfaceData'|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|error: 'SurfaceDataD2D' does not name a type; did you mean 'SurfaceData'?|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|error: expected '>' before '*' token|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|error: expected '(' before '*' token|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|error: expected primary-expression before '>' token|
C:\usr\Proj\cbBeta31\trunk\src\sdk\wxscintilla\src\PlatWX.cpp|1125|error: expected ')' before ';' token|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 13 second(s)) ===|

Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: sodev on May 24, 2019, 11:46:20 pm
Nope, you broke it more :). wxUSE_GRAPHICS_DIRECT2D is ALWAYS defined, but it has the value 0 if its off and 1 if its on. Your check always returns true but its value seems be 0, your error messages indicate that it doesn't find Direct2D related headers.

The problem is that setup.h does enable wxUSE_GRAPHICS_CONTEXT but not wxUSE_GRAPHICS_DIRECT2D

Code
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D 0
#endif

Easiest fix is to set it 1 in the #else case as well.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Pecan on May 25, 2019, 12:06:55 am
Thanks sodev

I reverted my local CB (removing all my dumb changes) and changed setup.h to specify
"#define wxUSE_GRAPHICS_DIRECT2D 1"

That solved the compile problem. But now I get Link errors.
Code
g++.exe -shared  -Wl,--out-implib=devel31_64\libcodeblocks.a -Wl,--dll -Lbase\tinyxml -LC:\usr\Proj\wxWidgets3110\lib\gcc_dll -Ldevel31_64 -Lsdk\scripting\lib .objs31_64\sdk\configmanager-revision.o .objs31_64\sdk\annoyingdialog.o .objs31_64\sdk\autodetectcompilers.o .objs31_64\sdk\base64.o .objs31_64\sdk\blockallocated.o .objs31_64\sdk\cbauibook.o .objs31_64\sdk\cbcolourmanager.o .objs31_64\sdk\cbdebugger_interfaces.o .objs31_64\sdk\cbeditor.o .objs31_64\sdk\cbeditorprintout.o .objs31_64\sdk\cbexception.o .objs31_64\sdk\cbplugin.o .objs31_64\sdk\cbproject.o .objs31_64\sdk\cbstatusbar.o .objs31_64\sdk\cbstyledtextctrl.o .objs31_64\sdk\cbthreadpool.o .objs31_64\sdk\cbtreectrl.o .objs31_64\sdk\cbworkspace.o .objs31_64\sdk\ccmanager.o .objs31_64\sdk\compileoptionsbase.o .objs31_64\sdk\compiler.o .objs31_64\sdk\compilercommandgenerator.o .objs31_64\sdk\compilerfactory.o .objs31_64\sdk\compileroptions.o .objs31_64\sdk\compiletargetbase.o .objs31_64\sdk\configmanager.o .objs31_64\sdk\configurationpanel.o .objs31_64\sdk\configuretoolsdlg.o .objs31_64\sdk\confirmreplacedlg.o .objs31_64\sdk\crc32.o .objs31_64\sdk\debuggermanager.o .objs31_64\sdk\editarrayfiledlg.o .objs31_64\sdk\editarrayorderdlg.o .objs31_64\sdk\editarraystringdlg.o .objs31_64\sdk\editor_hooks.o .objs31_64\sdk\editorbase.o .objs31_64\sdk\editorcolourset.o .objs31_64\sdk\editorlexerloader.o .objs31_64\sdk\editormanager.o .objs31_64\sdk\editpairdlg.o .objs31_64\sdk\editpathdlg.o .objs31_64\sdk\edittooldlg.o .objs31_64\sdk\encodingdetector.o .objs31_64\sdk\externaldepsdlg.o .objs31_64\sdk\filefilters.o .objs31_64\sdk\filegroupsandmasks.o .objs31_64\sdk\filemanager.o .objs31_64\sdk\findreplacedlg.o .objs31_64\sdk\genericmultilinenotesdlg.o .objs31_64\sdk\globals.o .objs31_64\sdk\importers_globals.o .objs31_64\sdk\incremental_select_helper.o .objs31_64\sdk\infowindow.o .objs31_64\sdk\loggers.o .objs31_64\sdk\logmanager.o .objs31_64\sdk\macrosmanager.o .objs31_64\sdk\manager.o .objs31_64\sdk\menuitemsmanager.o .objs31_64\sdk\mozilla_chardet\src\CharDistribution.o .objs31_64\sdk\mozilla_chardet\src\JpCntx.o .objs31_64\sdk\mozilla_chardet\src\LangBulgarianModel.o .objs31_64\sdk\mozilla_chardet\src\LangCyrillicModel.o .objs31_64\sdk\mozilla_chardet\src\LangGreekModel.o .objs31_64\sdk\mozilla_chardet\src\LangHebrewModel.o .objs31_64\sdk\mozilla_chardet\src\LangHungarianModel.o .objs31_64\sdk\mozilla_chardet\src\LangThaiModel.o .objs31_64\sdk\mozilla_chardet\src\nsBig5Prober.o .objs31_64\sdk\mozilla_chardet\src\nsCharSetProber.o .objs31_64\sdk\mozilla_chardet\src\nsEscCharsetProber.o .objs31_64\sdk\mozilla_chardet\src\nsEscSM.o .objs31_64\sdk\mozilla_chardet\src\nsEUCJPProber.o .objs31_64\sdk\mozilla_chardet\src\nsEUCKRProber.o .objs31_64\sdk\mozilla_chardet\src\nsEUCTWProber.o .objs31_64\sdk\mozilla_chardet\src\nsGB2312Prober.o .objs31_64\sdk\mozilla_chardet\src\nsHebrewProber.o .objs31_64\sdk\mozilla_chardet\src\nsLatin1Prober.o .objs31_64\sdk\mozilla_chardet\src\nsMBCSGroupProber.o .objs31_64\sdk\mozilla_chardet\src\nsMBCSSM.o .objs31_64\sdk\mozilla_chardet\src\nsSBCharSetProber.o .objs31_64\sdk\mozilla_chardet\src\nsSBCSGroupProber.o .objs31_64\sdk\mozilla_chardet\src\nsSJISProber.o .objs31_64\sdk\mozilla_chardet\src\nsUniversalDetector.o .objs31_64\sdk\mozilla_chardet\src\nsUTF8Prober.o .objs31_64\sdk\multiselectdlg.o .objs31_64\sdk\newfromtemplatedlg.o .objs31_64\sdk\personalitymanager.o .objs31_64\sdk\pipedprocess.o .objs31_64\sdk\pluginmanager.o .objs31_64\sdk\pluginsconfigurationdlg.o .objs31_64\sdk\printing_types.o .objs31_64\sdk\projectbuildtarget.o .objs31_64\sdk\projectfile.o .objs31_64\sdk\projectfileoptionsdlg.o .objs31_64\sdk\projectlayoutloader.o .objs31_64\sdk\projectloader.o .objs31_64\sdk\projectloader_hooks.o .objs31_64\sdk\projectmanager.o .objs31_64\sdk\projectsfilemasksdlg.o .objs31_64\sdk\projecttemplateloader.o .objs31_64\sdk\scripting\bindings\sc_consts.o .objs31_64\sdk\scripting\bindings\sc_dialog.o .objs31_64\sdk\scripting\bindings\sc_globals.o .objs31_64\sdk\scripting\bindings\sc_io.o .objs31_64\sdk\scripting\bindings\sc_plugin.o .objs31_64\sdk\scripting\bindings\sc_progress.o .objs31_64\sdk\scripting\bindings\sc_util_dialogs.o .objs31_64\sdk\scripting\bindings\sc_wxtypes.o .objs31_64\sdk\scripting\bindings\scriptbindings.o .objs31_64\sdk\scriptingmanager.o .objs31_64\sdk\scriptsecuritywarningdlg.o .objs31_64\sdk\scrollingdialog.o .objs31_64\sdk\sdk_events.o .objs31_64\sdk\searchresultslog.o .objs31_64\sdk\selecttargetdlg.o .objs31_64\sdk\templatemanager.o .objs31_64\sdk\tinywxuni.o .objs31_64\sdk\toolsmanager.o .objs31_64\sdk\uservarmanager.o .objs31_64\sdk\workspaceloader.o .objs31_64\sdk\xtra_res.o  -o devel31_64\codeblocks.dll -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--add-stdcall-alias -Wl,--enable-auto-import -Wl,--no-undefined  -lshfolder -ltxml31_64 -lwxscintilla_cb -lsqplus31_64 -lsqstdlib31_64 -lsquirrel31_64 -lgdi32 -lwxmsw31u
devel31_64/libwxscintilla_cb.a(PlatWX.o): In function `SurfaceFontDataD2D::SurfaceFontDataD2D(FontParameters const&)':
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:784: undefined reference to `__imp__Z15wxDWriteFactoryv'
devel31_64/libwxscintilla_cb.a(PlatWX.o): In function `SurfaceDataD2D::SurfaceDataD2D(ScintillaWX*)':
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:880: undefined reference to `__imp__Z13wxD2D1Factoryv'
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:880: undefined reference to `__imp__Z15wxDWriteFactoryv'
devel31_64/libwxscintilla_cb.a(PlatWX.o): In function `SurfaceD2D::SurfaceD2D()':
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:1077: undefined reference to `__imp__Z15wxDWriteFactoryv'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (2 minute(s), 37 second(s))
5 error(s), 22 warning(s) (2 minute(s), 37 second(s))

Is this an indication I need to re-compile wxWidgets 3.1.1 ? If so, what compile settings should I use?
Current my compile settings are (using gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0):
Code
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-std=gnu++11 -fno-keep-inline-dllexport -fpermissive -Wno-unused-local-typedefs -Wno-ignored-qualifiers -Wno-cast-function-type"

Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: sodev on May 25, 2019, 01:02:40 am
If you change anything in setup.h you always have to recompile wxWidgets, it is its main file to control how it gets compiled.

About compiler settings, i don't know, i build with the https://github.com/rjpcomputing/wxpack (https://github.com/rjpcomputing/wxpack) scripts, so i do what they do :).
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Pecan on May 25, 2019, 04:28:13 am
Resolved:
For windows:
1) change the line in setup.h from "#define wxUSE_GRAPHICS_DIRECT2D 0"
    "to: "#define wxUSE_GRAPHICS_DIRECT2D 1" (drop the quotes).
    For me, setup.h was at ...\wxWidgets3110\lib\gcc_dll\mswu\wx\setup.h
2) Recompile wxWidgets. I did not have to change any build parameters.
3) Recompile CB core, and plugins.
    Copy the wxWidgets executables to your CB output folder.
   For me, these were: ...\wxWidgets3110\lib\gcc_dll\wxmsw311u_gcc_cb.dll
   and ...\wxWidgets3110\lib\gcc_dll\wxmsw311u_gl_gcc_cb.dll
4) My compiler is mingw 8.1.0 gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0)
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: sodev on May 25, 2019, 05:25:09 am
Don't modify the files in the output directories, these files get put there by the build system and it updates them. The correct setup.h to modify is in include\wx\msw
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: gd_on on May 25, 2019, 09:48:51 am
Quote
the build system and it updates them
Not totally sure : I have also correctly built (as Pecan) a new wxwidgets by only modifying \lib\gcc_dll\mswu\wx\setup.h. The one in include\wx\msw seems to be used in a totally fresh build when the lib's one does not still exists. To be totally sure, you can modify both. Nevertheless, take care if you cross build wxwidgets for several OS.
gd_on
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: killerbot on May 30, 2019, 09:16:18 am
I ran into the same problem when trying to build the nightly, win10 64 bit, gcc 8.1.0.

I will try the same thing that Pecan "trial and error-ed", but then there is the discussion that actually that file can exist in 2 locations, ...

Can this please be documented somewhere on the wiki, this is a real breaking change (one could even argue it should not be allowed in such a quick commit), which actually breaks for many people on how to build CB, if we do such things, it should be clearly documented, and the forum is not a good place, things are hard to find. It should be very clear in some section of the wiki.
And a "proven, fact supported solution" if possible, and not trial and errors got it working.

Who can help ?

When there is a good documentation, I will merge it into my nightly cookbook article on the wiki.

I will also mention it in the nightly "Important changes" since it means redistribution of a new wx dll-s.

And while we are rebuilding wx anyway, how about step up to 3.1.2, at the moment nightly is still at 3.1.1 ?
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: Miguel Gimenez on May 30, 2019, 09:39:23 am
I am using wx3.1.2 in 32 bits and it works OK, but you will get crashes with Code Completion if you don't backport New Pagodi's changes to wxPopupWindow in wx trunk to wx3.1.2

I published a patch with this backport (and the final files for easier use) in the forum, see http://forums.codeblocks.org/index.php/topic,22974.msg156992.html#msg156992 (http://forums.codeblocks.org/index.php/topic,22974.msg156992.html#msg156992)

Regarding the wxWidgets configuration for Direct2D, if lib/gcc_dll/mswu/wx/setup.h exists then it is used for the compilation; if not, then include/wx/msw/setup.h is copied there when compilation starts. Cleaning the target does not delete the setup.h under lib, so any changes made to include/wx/msw/setup.h are ignored. EDIT: the safest way is deletion of lib/gcc_dll (or the 64 variant), edition of include/wx/msw/setup.h and making from scratch.

The only change required to setup.h is from

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

to

Code
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#endif

or

Code
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: gd_on on May 30, 2019, 11:29:30 am
Hi,
Quote
And while we are rebuilding wx anyway, how about step up to 3.1.2
To share my experience, I use myself wx 3.1.2 in 64 bits (since january). I have only added the "temporary" patch proposed by M. Gimenez in http://forums.codeblocks.org/index.php/topic,22974.msg156799.html#msg156799 and it works well. The advantage of this patch, is that it needs only a C::B code modification (though M. Gimenez declare it as non optimal)
I have not used the other patch (in http://forums.codeblocks.org/index.php/topic,22974.msg156992.html#msg156992) because it needs a wxwidgets 3.1.2 modification. And, if I understand well, these modifications have already been included in wxWidget 3.1.3 (by New Pagodi) ... but it's certainly too early to use this new future wx version !
gd_on
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: sodev on May 30, 2019, 02:16:06 pm
There are as many setup.h files as variants you build plus one, in my case i have 9, 4 variants for GCC and 4 variants for MSVC. And those are not present before you actually build the variant at least one time. The wxWidgets documentation clearly tells you how to do the build, you modify the one in the include directory. This is a limitation of Windows where you don't have Autotools, no need to do that on Linux, there you setup the build using the configure script. Recent versions of wxWidgets can be build with CMake, didn't try this by myself, maybe that way is easier to use than the pregenerated Makefile's.

If you don't want to use a custom wxWidgets configuration (i think that is not a problem on Windows, there is usually no system wide library available unlike on Linux) the most proper way would be to figure out which MinGW versions do offer Direct2D support like it is done with the graphics context and propose a PR to wxWidgets so the default configuration will use Direct2D if available. But i don't know if this is possible reliable, AFAIK this is not really related to the compiler version but more to the WinAPI version, but this should also hold true for the graphics context.

About which revision to use, you are building nightly releases, why don't you use "nightly" wxWidgets revisions aka something recent from master? I am using master revisions of wxWidgets for many years now, only a few times i picked a "bad" revision that broke something, but way more often i just got new features and fixes plus i was up to date with breaking api changes. After all you are doing way less releases than wxWidgets, shouldn't be hard to synchronize your own release to one of wxWidgets if you insist on using a release version of it for a release ;)
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: oBFusCATed on May 30, 2019, 08:25:09 pm
(one could even argue it should not be allowed in such a quick commit)
Sorry for the inconvenience, but this is the only way to force people to fix their builds. If I haven't done this the next night build would have mentioned that ligatures worked, but the wouldn't.
Also anyone could just comment this lines, so it is not really a show stopper.

Unfortunately I haven't to documented what I did the first  time I was testing this and now it just worked. :(
If someone is adding stuff to the wiki probably these pages should be updated:
https://wiki.wxwidgets.org/CodeBlocks_Setup_Guide
http://wiki.codeblocks.org/index.php/Compiling_wxWidgets_3.0.0_to_develop_Code::Blocks_(MSW)
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: stahta01 on May 31, 2019, 02:21:49 am
In about 2 weeks, I hope to have a patch to submit to the wxWidgets master branch to fix this issue for mingw64 gcc builds. I am testing my change to see if it works; then, I need to re-read the setup.h patch documentation to see how to do it.

My patch to fix only configure/make builds. Still needs tested. Patch failed testing!
Code
--- a/setup.h.in
+++ b/setup.h.in
@@ -671,7 +671,7 @@
 
 #define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT
 
-#if defined(_MSC_VER) && _MSC_VER >= 1600
+#if defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__MINGW64_TOOLCHAIN__)
     #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
 #else
     #define wxUSE_GRAPHICS_DIRECT2D 0

Tim S.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: oBFusCATed on May 31, 2019, 09:12:34 am
This won't be accepted. I'll have to make more elaborate test because some versions/releases of mingw doesn't have the correct direct2d headers in them.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: stahta01 on May 31, 2019, 09:34:10 am
This won't be accepted. I'll have to make more elaborate test because some versions/releases of mingw doesn't have the correct direct2d headers in them.

What version of mingw64 does not have the correct headers?

Note: I found a bug in the order of includes in wx/platform.h and that will likely prevent my wxWidgets patch from working or being accepted.

Edit: More looking into the problem suggest using "wx/msw/chkconf.h" to disable wxUSE_GRAPHICS_DIRECT2D; after it is enabled in setup.h for mingw GCC.
But, I would first have to find out what run-time header version work for both mingw.org and mingw64.
I have decided this is too much work for me at this time.

Tim S.
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: oBFusCATed on May 31, 2019, 08:18:52 pm
What version of mingw64 does not have the correct headers?
Not sure, but I'm sure this is not there just because they don't like mingw... You can ask on wx-dev...
Title: Re: Problem compìling after r11701 (related to Direct2D)
Post by: tomay3000 on June 07, 2019, 05:25:34 pm
Code
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#endif

Using this workaround and recompiled wx worked for me.

wxWidgets : 3.1.3 trunk
C::B : 11712 trunk
Mingw-w64 G++ : 9.1.0