Hello everybody,
First of all thanks for codebloks, its really looking promising, but problems never ends :)
I have trouble compiling default wxWidgets application which i get from new project-> wxWidgets application.
I added include and lib directories from wxWidgets 2.6.0 for compiler and linker in build options.
When i try to compile whit MS Free Toolkit 2003 (i added Platform SDK and corresponding directories for include and lib), compilation went smoothly but linker complaint that he can't found ctl3d32.lib. I try to erase that lib from codebloks build option and than linker couldn't find MSVCRTD.lib; i added that lib from ms visual studio 2003 to lib directories from MS Free Toolkit and than i got many of already defined link errors.
I also tried with GCC and i get next error from compiler
Project : wxWidgets application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\TEMP\wxWidgets1\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
In file included from C:/wx/wxWidgets/2.6.0/include/wx/platform.h:260,
from C:/wx/wxWidgets/2.6.0/include/wx/defs.h:21,
from C:/wx/wxWidgets/2.6.0/include/wx/wxprec.h:13,
from app.h:4,
from main.h:4,
from main.cpp:1:
C:/wx/wxWidgets/2.6.0/include/msvc/wx/setup.h:111:6: #error "This file should only be included when using Microsoft Visual C++"
Version of codebloks is 1.0-RC1
Can anyone help me?
GCC
This time I include right header, and compilation went fine but linker stuck. I compiled wxWidgets with MS Visual Studio 7.1, and it cross on my mind that maybe I can't use GCC with wxWidgets libs that was compiled with MSVC. So I downloaded cygwin and compile wxWidgets with it; after little struggle I manage to compile wxWidgets. Back to CodeBloks, changed libs dir, and tried to rebuild all – program was compiled but, again, linking failed. Here is output:
Project : wxWidgets application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\TEMP\wxWidgets1\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
Compiling: app.cpp
Linking executable: C:\TEMP\wxWidgets1\wxWidgets.exe
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x138): undefined reference to `wxWindow::RegisterHotKey(int, int, int)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x13c): undefined reference to `wxWindow::UnregisterHotKey(int)'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_wxchar.o): In function `Z7wxMB2WCPwPKcj':
../../src/common/wxchar.cpp:79: undefined reference to `mbsrtowcs'
../../src/common/wxchar.cpp:86: undefined reference to `mbsrtowcs'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_wxchar.o): In function `Z7wxWC2MBPcPKwj':
../../src/common/wxchar.cpp:106: undefined reference to `wcsrtombs'
../../src/common/wxchar.cpp:113: undefined reference to `wcsrtombs'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_log.o):../../src/common/log.cpp:532: undefined reference to `__getreent'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_log.o):../../src/common/log.cpp:532: undefined reference to `__getreent'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_log.o):../../src/common/log.cpp:551: undefined reference to `__getreent'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_utils.o): In function `Z12wxGetHomeDirP8wxString':
../../src/msw/utils.cpp:395: undefined reference to `cygwin_conv_to_full_win32_path'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_filename.o):../../src/common/filename.cpp:1063: undefined reference to `CoCreateInstance@20'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_filename.o):../../src/common/filename.cpp:1069: undefined reference to `IID_IPersistFile'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_filefn.o): In function `Z21wxGetWorkingDirectoryPci':
../../src/common/filefn.cpp:1459: undefined reference to `cygwin_conv_to_full_win32_path'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_filefn.o): In function `Z13wxGetFileKindi':
../../src/common/filefn.cpp:1928: undefined reference to `get_osfhandle'
C:\wx\wxWidgets\2.6.0\lib\gcc_lib/libwx_based-2.6.a(baselib_msgout.o):../../src/common/msgout.cpp:104: undefined reference to `__getreent'
.......
MSVC Toolkit
Here are link errors I get when copy MSVCRTD.lib from visual studio to toolkit
Project : wxWidgets application
Compiler : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : C:\TEMP\wxWidgets1\
--------------------------------------------------------------------------------
Switching to target: default
main.cpp
cl : Command line warning D4002 : ignoring unknown option '-pipe'
cl : Command line warning D4002 : ignoring unknown option '-mthreads'
cl : Command line warning D4002 : ignoring unknown option '-fno-pcc-struct-return'
cl : Command line warning D4002 : ignoring unknown option '-fno-rtti'
cl : Command line warning D4002 : ignoring unknown option '-fno-exceptions'
app.cpp
cl : Command line warning D4002 : ignoring unknown option '-pipe'
cl : Command line warning D4002 : ignoring unknown option '-mthreads'
cl : Command line warning D4002 : ignoring unknown option '-fno-pcc-struct-return'
cl : Command line warning D4002 : ignoring unknown option '-fno-rtti'
cl : Command line warning D4002 : ignoring unknown option '-fno-exceptions'
Linking executable: C:\TEMP\wxWidgets1\wxWidgets.exe
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _malloc already defined in LIBC.lib(malloc.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _realloc already defined in LIBC.lib(realloc.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _memmove already defined in LIBC.lib(memmove.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _free already defined in LIBC.lib(free.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _tolower already defined in LIBC.lib(tolower.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _calloc already defined in LIBC.lib(calloc.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _atoi already defined in LIBC.lib(atox.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _exit already defined in LIBC.lib(crt0dat.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _abort already defined in LIBC.lib(abort.obj)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: _strncpy already defined in LIBC.lib(strncpy.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBC.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBC.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
wxbase26d.lib(appbase.obj) : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "bool __cdecl DoShowAssertDialog(class wxString const &)" (?DoShowAssertDialog@@YA_NABVwxString@@@Z)
wxbase26d.lib(log.obj) : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "void __cdecl wxLogSysErrorHelper(long)" (?wxLogSysErrorHelper@@YAXJ@Z)
wxmsw26d_core.lib(app.obj) : error LNK2001: unresolved external symbol __imp__MessageBoxA@16
wxmsw26d_core.lib(msgdlg.obj) : error LNK2001: unresolved external symbol __imp__MessageBoxA@16
wxmsw26d_core.lib(evtloop.obj) : error LNK2001: unresolved external symbol __imp__PostMessageA@16
wxbase26d.lib(thread.obj) : error LNK2019: unresolved external symbol __imp__PostMessageA@16 referenced in function "public: enum wxThreadError __thiscall wxThreadInternal::WaitForTerminate(class wxCriticalSection &,void * *,class wxThread *)" (?WaitForTerminate@wxThreadInternal@@QAE?AW4wxThreadError@@AAVwxCriticalSection@@PAPAXPAVwxThread@@@Z)
wxbase26d.lib(utils.obj) : error LNK2001: unresolved external symbol __imp__PostMessageA@16
wxmsw26d_core.lib(frame.obj) : error LNK2001: unresolved external symbol __imp__PostMessageA@16
wxmsw26d_core.lib(app.obj) : error LNK2001: unresolved external symbol __imp__PostMessageA@16
wxbase26d.lib(thread.obj) : error LNK2019: unresolved external symbol __imp__MsgWaitForMultipleObjects@20 referenced in function "public: enum wxThreadError __thiscall wxThreadInternal::WaitForTerminate(class wxCriticalSection &,void * *,class wxThread *)" (?WaitForTerminate@wxThreadInternal@@QAE?AW4wxThreadError@@AAVwxCriticalSection@@PAPAXPAVwxThread@@@Z)
wxbase26d.lib(thread.obj) : error LNK2019: unresolved external symbol __imp__PostThreadMessageA@16 referenced in function "void __cdecl wxWakeUpMainThread(void)" (?wxWakeUpMainThread@@YAXXZ)
wxmsw26d_core.lib(evtloop.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function "public: virtual void __thiscall wxEventLoop::Exit(int)" (?Exit@wxEventLoop@@UAEXH@Z)
wxmsw26d_core.lib(printwin.obj) : error LNK2001: unresolved external symbol __imp__PeekMessageA@20
wxbase26d.lib(basemsw.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function "public: virtual void __thiscall wxConsoleAppTraits::AlwaysYield(void)" (?AlwaysYield@wxConsoleAppTraits@@UAEXXZ)
wxmsw26d_core.lib(window.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function "public: virtual bool __thiscall wxWindow::RegisterHotKey(int,int,int)" (?RegisterHotKey@wxWindow@@UAE_NHHH@Z)
wxmsw26d_core.lib(app.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function "public: static int __cdecl wxApp::GetComCtl32Version(void)" (?GetComCtl32Version@wxApp@@SAHXZ)
wxmsw26d_core.lib(utilsgui.obj) : error LNK2001: unresolved external symbol __imp__PeekMessageA@20
wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__GetWindowThreadProcessId@8 referenced in function "int __stdcall wxEnumFindByPidProc(struct HWND__ *,long)" (?wxEnumFindByPidProc@@YGHPAUHWND__@@J@Z)
wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__EnumWindows@8 referenced in function "int __cdecl wxKill(long,enum wxSignal,enum wxKillError *,int)" (?wxKill@@YAHJW4wxSignal@@PAW4wxKillError@@H@Z)
wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__ExitWindowsEx@8 referenced in function "bool __cdecl wxShutdown(enum wxShutdownFlags)" (?wxShutdown@@YA_NW4wxShutdownFlags@@@Z)
wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__MessageBeep@4 referenced in function "void __cdecl wxBell(void)" (?wxBell@@YAXXZ)
wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function _wxCreateHiddenWindow
wxmsw26d_core.lib(toplevel.obj) : error LNK2001: unresolved external symbol __imp__RegisterClassA@4
wxmsw26d_core.lib(app.obj) : error LNK2001: unresolved external symbol __imp__RegisterClassA@4
wxmsw26d_core.lib(notebook.obj) : error LNK2001: unresolved external symbol __imp__RegisterClassA@4
wxmsw26d_core.lib(tooltip.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
wxmsw26d_core.lib(spinctrl.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "public: virtual __thiscall wxCommandEvent::~wxCommandEvent(void)" (??1wxCommandEvent@@UAE@XZ)
wxmsw26d_core.lib(bmpbuttn.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
wxmsw26d_core.lib(slider95.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
wxbase26d.lib(utils.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "struct HWND__ * __cdecl CreateWindow(char const *,char const *,unsigned long,int,int,int,int,struct HWND__ *,struct HMENU__ *,struct HINSTANCE__ *,void *)" (?CreateWindow@@YAPAUHWND__@@PBD0KHHHHPAU1@PAUHMENU__@@PAUHINSTANCE__@@PAX@Z)
wxmsw26d_core.lib(toplevel.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
wxmsw26d_core.lib(window.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
wxmsw26d_core.lib(control.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
wxmsw26d_core.lib(textctrl.obj) : error LNK2001: unresolved external symbol __imp__SetCursor@4
wxmsw26d_core.lib(cursor.obj) : error LNK2001: unresolved external symbol __imp__SetCursor@4
wxbase26d.lib(crashrpt.obj) : error LNK2019: unresolved external symbol __imp__SetCursor@4 referenced in function "public: __thiscall BusyCursor::BusyCursor(void)" (??0BusyCursor@@QAE@XZ)
wxmsw26d_core.lib(window.obj) : error LNK2019: unresolved external symbol __imp__SetCursor@4 referenced in function "char const * __cdecl wxGetMessageName(int)" (?wxGetMessageName@@YAPBDH@Z)
wxmsw26d_core.lib(utilsgui.obj) : error LNK2001: unresolved external symbol __imp__SetCursor@4
Process terminated with status 1 (0 minutes, 15 seconds)
52 errors, 1 warnings
I don't know those it matter but I didn't downloaded Platform SDK, I used one from MS Visual Studio installation. Then I tried with libs from Visual Studio, and I get identical errors like above.
Finally I compiled release version of wxWidgets with help of MS Visual Studio and give it a try, and again I have got same errors.
Where the hell I mistaking?
Why is so hard to make code::bloks compile wxWidgets applications? I read posts on forum and find out that there are many peoples who had problems whit this issue. When I find code::bloks on internet, couple days ago, and read that it is build with wxWidgets, I thought that compiling and running wxWidgets application from Code::Bloks would be easy thing, but it become very difficult thing.
Hi all,
Or here http://wiki.wxwidgets.org/wiki.pl?CodeBlocks_Setup_Guide
ok, the guide says (I am using cygwin for compilation)
cd %WXWIN%\build\msw
make -f makefile.gcc clean
and I get bunch of error like
ivica@none-vzk04m85es /cygdrive/c/wx/wxWidgets/2.6.0/build/msw
$ make -f makefile.gcc clean
if exist gcc_mswd\*.o del gcc_mswd\*.o
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: [clean] Error 2 (ignored)
if exist ..\..\lib\gcc_lib\libwxregexd.a del ..\..\lib\gcc_lib\libwxregexd.a
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: [clean] Error 2 (ignored)
if exist ..\..\lib\gcc_lib\libwxzlibd.a del ..\..\lib\gcc_lib\libwxzlibd.a
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: [clean] Error 2 (ignored)
if exist ..\..\lib\gcc_lib\libwxpngd.a del ..\..\lib\gcc_lib\libwxpngd.a
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: [clean] Error 2 (ignored)
if exist ..\..\lib\gcc_lib\libwxjpegd.a del ..\..\lib\gcc_lib\libwxjpegd.a
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: [clean] Error 2 (ignored)
....
Never mind, I clean all libs by hand from previous compilation. Then goes next command
make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 VENDOR=cb
end I get next output
ivica@none-vzk04m85es /cygdrive/c/wx/wxWidgets/2.6.0/build/msw
$ make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0
VENDOR=cb
if not exist gcc_mswdll mkdir gcc_mswdll
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: [gcc_mswdll] Error 2 (ignored)
if not exist ..\..\lib\gcc_dll mkdir ..\..\lib\gcc_dll
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [..\..\lib\gcc_dll] Error 2
what now? Seems that my bash shell from cygwin don't understand default makefile from wxWidgets.
However, I have already recommended you to compile wxWidgets from the makefiles and not from C::B, you should try.
I never try to compile wxWidgets from C::B. I compiled wxWidgets 2.6.0 with MS Visual Studio 7.1 and also with cygwin. With MS I didn't have any problem, but with cygwin I had. The default makefile that ships with wxWidgets wont work with my bash shell from cygwin, see above. But it worked with combination (this is from INSTALL-MSW.txt from wxWidgets)
$../configure --with-msw --enable-debug --enable-debug_gdb –disable-shared
$make
Then I compiled minimal sample from sample dir of wxWidgets and it worked, I have got windows with to menu button. So everything went ok.
Then I made default wxWidgets application in C::B, I have set include directories for GCC compiler like
C:\wx\wxWidgets\2.6.0\include
C:\wx\wxWidgets\2.6.0\lib\gcc_lib\mswd
added link dir
C:\wx\wxWidgets\2.6.0\lib\gcc_lib
and added link libraries
libwx_based-2.6
libwx_core-2.6
and get errors from my previous post.
Well inspired;) with text from http://wiki.wxwidgets.org/wiki.pl?CodeBlocks_Setup_Guide I tried next, from mine cygwin:
$ ../configure --with-msw --enable-xrc --enable-shared --enable-monolithic --en
able-vendor=CB
I didn't find switch for disabling debug, well...
Next I did $make and I've get next libs
libwxjpegd-2.6.a
libwxpngd-2.6.a
libwxtiffd-2.6.a
libwx_mswd-2.6.dll.a
libwx_mswd_stc-2.6.dll.a (yes, I've also compiled stc)
wxmsw26d_gcc_cb.dll
wxmsw26d_stc_gcc_cb.dll
I opened C::B, started a new wxWidgets project, with project options – Using wxWidgets DLL. Compiled and linked, and surprise, everything went ok except 4 warnings
Project : wxWidgets application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\TEMP\wxWidgets3\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
In file included from C:/wx/wxWidgets/2.6.0/include/wx/wxchar.h:152,
from C:/wx/wxWidgets/2.6.0/include/wx/debug.h:22,
from C:/wx/wxWidgets/2.6.0/include/wx/defs.h:450,
from C:/wx/wxWidgets/2.6.0/include/wx/wxprec.h:13,
from app.h:4,
from main.h:4,
from main.cpp:1:
C:/Program Files/CodeBlocks/include/tchar.h:274:1: warning: "_puttchar" redefined
In file included from C:/wx/wxWidgets/2.6.0/include/wx/platform.h:545,
from C:/wx/wxWidgets/2.6.0/include/wx/defs.h:21,
from C:/wx/wxWidgets/2.6.0/include/wx/wxprec.h:13,
from app.h:4,
from main.h:4,
from main.cpp:1:
C:/wx/wxWidgets/2.6.0/include/wx/msw/gccpriv.h:108:1: warning: this is the location of the previous definition
Compiling: app.cpp
In file included from C:/wx/wxWidgets/2.6.0/include/wx/wxchar.h:152,
from C:/wx/wxWidgets/2.6.0/include/wx/debug.h:22,
from C:/wx/wxWidgets/2.6.0/include/wx/defs.h:450,
from C:/wx/wxWidgets/2.6.0/include/wx/wxprec.h:13,
from app.h:4,
from app.cpp:1:
C:/Program Files/CodeBlocks/include/tchar.h:274:1: warning: "_puttchar" redefined
In file included from C:/wx/wxWidgets/2.6.0/include/wx/platform.h:545,
from C:/wx/wxWidgets/2.6.0/include/wx/defs.h:21,
from C:/wx/wxWidgets/2.6.0/include/wx/wxprec.h:13,
from app.h:4,
from app.cpp:1:
C:/wx/wxWidgets/2.6.0/include/wx/msw/gccpriv.h:108:1: warning: this is the location of the previous definition
Linking executable: C:\TEMP\wxWidgets3\wxWidgets.exe
Process terminated with status 0 (0 minutes, 21 seconds)
0 errors, 4 warnings
What a hell, I can live with that:))
So I hit run and my application complained about 4 missing dll's:
wxmsw26d_gcc_cb.dll
cygwin1.dll
cygexpat-0.dll
cygz.dll
I've copied those dll's to dir where my wxWidgets application is, and hit run again. This time a windows pop up saying “wxWidgets.exe has encountered a problem and needs to close. We are sorry for the inconvenience.“
Really no ideas, what to do next.