I am seeing same results with wxUSE_STL = 0.
I worked around it by changing private.h (just for the offending build targets):
Replace line 680 with: m_clsname = wxString::FromUTF8(wc.lpszClassName);
Replace line 695 with: if ( !::UnregisterClass(m_clsname.mb_str(), wxhInstance) )
Replace wxGetFullModuleName at line 773 with: inline wxString wxGetFullModuleName(HMODULE hmod)
{
wxString fullname;
char cName[MAX_PATH];
if ( !::GetModuleFileName
(
hmod,
cName,
MAX_PATH
) )
{
wxLogLastError(_T("GetModuleFileName"));
}
fullname = wxString::FromUTF8(cName);
return fullname;
}
This was rather irksome but allowed me to build the project. We need to resolve this issue. It only affects some build targets even though others use the same private.h file so these functions do work but maybe some configuration difference between the build targets.
Find a possible cause in the Code::Blocks source code.
Edit: The patch below is only a possible work around it is *not* a proper fix.
diff --git a/src/plugins/codecompletion/selectincludefile.cpp b/src/plugins/codecompletion/selectincludefile.cpp
index a2f62fbef..10adfac3d 100644
--- a/src/plugins/codecompletion/selectincludefile.cpp
+++ b/src/plugins/codecompletion/selectincludefile.cpp
@@ -7,7 +7,7 @@
* $HeadURL$
*/
-#include "prep.h"
+#include <sdk.h>
#include "selectincludefile.h"
#include <wx/xrc/xmlres.h>
I changed several things at the same time; so, the patch may not be the solution.
Tim S.
I confirm that the patch provided by stahta01 resolves the build issue with minGW32. I had separately discovered that removing precompiled header definitions helped.
I have found similar issue with the following plugins that may be worked-around by removing WX_PRECOMP and CB_PRECOMP from the defines
- wxSmith - Contrib Items
- AutoVersioning
- Games
- Code Snippets wx2.8.x
- SpellChecker wx2.8.x
Should these plugin failures be reported separately or managed within this ticket?
FYI The installation of minGW32 on my Windows 7 Professional machine reports WINVER=0x0500 and _WIN32_WINNT=0x0500 which causes the build to fail due to various dependencies on >=0x0501. I resolved this by adding
WINVER=0x0601
_WIN32_WINNT=0x0601
to defines of the project. I will report this separately.
When I have time, I will create a separate patch for each plugin.
I suggest you report all of the problem plugins in one report on sf.net.
I will the reference your report of bug in my patch files.
edit: I am testing with these compiler defines; these defines should be added to the compiler; I consider this a mingw.org compiler bug/WAD.
WAD = works as designed. I may need to up WINVER to match your value later in testing.
WINVER=0x0501
_WIN32_IE=0x0601
Tim S.
Partial build log showing error; before I try to fix it. The build log was too long so edited it down.
-------------- Build: default in AutoVersioning (compiler: GNU GCC 6.3.0 mingw.org Compiler)---------------
mingw32-g++.exe -Wall -g -std=gnu++11 -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DWINVER=0x0501 -D_WIN32_IE=0x0601 -I..\..\..\include -I..\..\..\include\tinyxml -I..\..\..\sdk\wxscintilla\include -IC:\Users\stahta01\devel\open_source_code\version_control\git_repos\wxWidgets_2_8_branch\include -IC:\Users\stahta01\devel\open_source_code\version_control\git_repos\wxWidgets_2_8_branch\lib\gcc_dll\mswu -c C:\Users\stahta01\devel\open_source_code\version_control\git_repos\codeblocks_PCH_fixes\src\plugins\contrib\AutoVersioning\AutoVersioning.cpp -o ..\..\..\.objs\plugins\contrib\AutoVersioning\AutoVersioning.o
SNIP
C:\Users\stahta01\devel\open_source_code\version_control\git_repos\wxWidgets_2_8_branch\include/wx/msw/private.h:680:28: error: ambiguous overload for 'operator=' (operand types are 'wxString' and 'const LPCSTR {aka const char* const}')
m_clsname = wc.lpszClassName;
^~~~~~~~~~~~~