Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Weird linking error on wxSmith plugin on Windows

(1/2) > >>

stahta01:
Likely caused by
Commit [r10872]
"* Linux (autofoo): use system provided squirrel if installed (based on Fedoras unbundle-patch)".

Patch that needs more testing below. Deleted patch that had an typo in it.


Edit: It took me 4 hours the find the cause; too tired to do any more testing.
Edit2: Now my fix is NOT working I give up; maybe my computer is being haunted.

Tim S.

Jenna:
Did you build C::B from clean sources (make sure all former build suirrel lib(s) are removed ?
If that does not work:
did you try to completely revert this change (just comment out the "#undef"") and build C::B from clean sources ?

stahta01:
Commenting out the "#undef _UNICODE" fixed the wxSmith Plugin; just noticed I was missing the n in "#ifndef".
Edit: Some of my past trial fixes broke the CB Core Project; so, I am rebuilding that and wxSmith to test.

The root problem on windows is the including of the header "windows.h" with _UNICODE undefined.
I have yet to locate that include on my computer; might be in my Compiler.
If this does NOT work will see if an TDM MinGW GCC compiler has the issue.


--- Code: ---diff --git a/src/include/scripting/sqplus/sqplus.h b/src/include/scripting/sqplus/sqplus.h
index 4817b1c..681783e 100644
--- a/src/include/scripting/sqplus/sqplus.h
+++ b/src/include/scripting/sqplus/sqplus.h
@@ -47,9 +47,12 @@
 #define SQ_CALL_RAISE_ERROR SQFalse
 #endif
 
+// C::B patch: undef of "_UNICODE"
 // this does the same as commenting out the "#ifdef _UNICODE"-stuff in our
 // bundled squirrel.h, but works also for system-squirrel
+#ifndef __WXMSW__
 #undef _UNICODE
+#endif
 #include "squirrel.h"
 
 // C::B patch: so it builds on 64bit, ecapsulate bool/int/float using Squirrel types (this patch applies everywhere, where threse types are used)

--- End code ---

stahta01:
Yes, Adding the n to "#ifndef" fixed the build issue; I was just too tired yesterday.

Now I am building the "CodeBlocks.workspace" to verify the other plugins still build.
Edit: The other plugins all built without linker errors.

Tim S.

stahta01:
The wxSmith Compiler error that my patch above fixes.


--- Code: ----------------- Build: wxSmithLib in wxSmith (compiler: GNU GCC Compiler)---------------

i686-w64-mingw32-g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -Wno-attributes -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DBUILDING_PLUGIN -DwxUSE_UNICODE -std=gnu++11 -Wno-deprecated-declarations -Wno-unused-local-typedefs -IC:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\lib\gcc_dll\mswu -IC:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include -I..\..\..\include -I..\..\..\include\tinyxml -I..\..\..\sdk\wxpropgrid\include -I..\..\..\sdk\wxscintilla\include -I..\..\..\include\scripting\include -I..\..\..\include\scripting\squirrel -I..\..\..\include\scripting\sqplus -I..\..\..\include\scripting\bindings -I..\..\..\include\mozilla_chardet -I..\..\..\include\mozilla_chardet\mfbt -I..\..\..\include\mozilla_chardet\nsprpub\pr\include -I..\..\..\include\mozilla_chardet\xpcom -I..\..\..\include\mozilla_chardet\xpcom\base -I..\..\..\include\mozilla_chardet\xpcom\glue -c C:\Devel\open_source_code\version_control\codeblocks_custom_build-git\src\plugins\contrib\wxSmith\wxsmith.cpp -o ..\..\..\.objs\plugins\contrib\wxSmithLib\wxsmith.o
In file included from C:/Apps32/MSys2/mingw32/i686-w64-mingw32/include/windows.h:72:0,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/wrapwin.h:51,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontutil.h:26,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontmap.h:24,
                 from ..\..\..\include/cbeditor.h:11,
                 from ..\..\..\include\scripting\bindings/sc_base_types.h:26,
                 from C:\Devel\open_source_code\version_control\codeblocks_custom_build-git\src\plugins\contrib\wxSmith\wxsmith.cpp:39:
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h: In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h:41:20: error: cannot convert 'LPCTSTR {aka const wchar_t*}' to 'LPCSTR {aka const char*}' for argument '2' to 'HWND__* CreateDialogParamA(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM)'
             return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
                    ^
In file included from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/wrapwin.h:58:0,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontutil.h:26,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontmap.h:24,
                 from ..\..\..\include/cbeditor.h:11,
                 from ..\..\..\include\scripting\bindings/sc_base_types.h:26,
                 from C:\Devel\open_source_code\version_control\codeblocks_custom_build-git\src\plugins\contrib\wxSmith\wxsmith.cpp:39:
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h: In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h:75:48: error: cannot convert 'LPCTSTR {aka const wchar_t*}' to 'LPCSTR {aka const char*}' for argument '14' to 'HFONT__* CreateFontA(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCSTR)'
                                family, facename);
                                                ^
In file included from C:/Apps32/MSys2/mingw32/i686-w64-mingw32/include/windows.h:72:0,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/wrapwin.h:51,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontutil.h:26,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontmap.h:24,
                 from ..\..\..\include/cbeditor.h:11,
                 from ..\..\..\include\scripting\bindings/sc_base_types.h:26,
                 from C:\Devel\open_source_code\version_control\codeblocks_custom_build-git\src\plugins\contrib\wxSmith\wxsmith.cpp:39:
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h: In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h:98:20: error: cannot convert 'LPCTSTR {aka const wchar_t*}' to 'LPCSTR {aka const char*}' for argument '2' to 'HWND__* CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'
             return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h,
                    ^
In file included from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/wrapwin.h:58:0,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontutil.h:26,
                 from C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/fontmap.h:24,
                 from ..\..\..\include/cbeditor.h:11,
                 from ..\..\..\include\scripting\bindings/sc_base_types.h:26,
                 from C:\Devel\open_source_code\version_control\codeblocks_custom_build-git\src\plugins\contrib\wxSmith\wxsmith.cpp:39:
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h: In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h:114:44: error: cannot convert 'LPCTSTR {aka const wchar_t*}' to 'LPCSTR {aka const char*}' for argument '2' to 'HMENU__* Load
MenuA(HINSTANCE, LPCSTR)'
             return LoadMenuA(instance, name);
                                            ^
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h: In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h:320:51: error: cannot convert 'LPCTSTR {aka const wchar_t*}' to 'LPCSTR {aka const char*}' for argument '2' to 'HICON__* LoadIconA(HINSTANCE, LPCSTR)'
             return LoadIconA(hInstance, lpIconName);
                                                   ^
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h: In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':
C:\Devel\open_source_code\no_version_control\wxMSW-2.8\wxMSW-2.8.12_Msys2\include/wx/msw/winundef.h:333:55: error: cannot convert 'LPCTSTR {aka const wchar_t*}' to 'LPCSTR {aka const char*}' for argument '2' to 'HBITMAP__* LoadBitmapA(HINSTANCE, LPCSTR)'
             return LoadBitmapA(hInstance, lpBitmapName);
                                                       ^
Process terminated with status 1 (0 minute(s), 30 second(s))
6 error(s), 0 warning(s) (0 minute(s), 30 second(s))

--- End code ---

NOTE: The normal fix of this type of error of this code below; only changed the compiler error into a linker error!

--- Code: ---//
// Added to top of wxsmith.cpp and wxwidgets/wxwidgetsresfactory.cpp files.
//
#ifdef __WXMSW__
#include <wx/msw/wrapwin.h>  // includes <windows.h>
#endif

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version