Hope this is the right place for this question. First time posting a question -- I'd rather have figured this out myself.
I am new to codeblocks and C++ programming, but I have hit the wall trying to setup wxWidgets with codeblocks, and unable to figure this out with the documents I've studied. Sorry for the long question, but I believe that the answer would make a nice wiki to help users understand how to set this up.
I'm running CB 10.05, and wxWidgets 2.9.1 on Win2000. I can successfully compile wxWidgets three different ways, using parameters to indicate compiling monolithic, dll, debug, etc.:
1) ../configure then make
puts the libs and wx-config in the user defined folder; include is in $(#wx)/include
2) ../configure then make then make install
puts libs, include, wx-config in /usr/local/lib (for me, c:\dev\msys\local\lib)
3) minGW32-make.
puts libs in $(#wx)/lib/gcc_dll, no wx-config, include is in $(#wx)/include
They all compile without problems. But each of these methods results in the libs in different directories; some create a wx-config file and some do not (method 3).
I then test my set up by trying to compile/link/run a wxSmith minimal project, and the minimal sample cpp file through CB. I've tried setting up CB multiple ways with each compilation. I get linker errors, such as:
D:\Projects32\Codeblocks\test\test12\test12App.cpp|17|undefined reference to ` _imp___Z7wxEntryP11HINSTANCE__S0_Pci'|
I've spent the last couple of weeks trying to figure out how to set the compiler and linker parameters with CB; none seem to work.
My first question is simply where CB assumes the library and header directories are located? I assume when you set the base for $(#wx), it assumes these are in certain folders. For instance, if I knew that the libs are assumed to be in $(#wx)/lib/gcc_dll, then I presume I would need to specify an alternate lib folder if compiling with method 1 or 2 (correct?).
Here is my current setup: The most current wxWidgets compilation uses method 3 (minGW32-make) which puts libs in $(#wx)/lib/gcc_dll; it is not monolithic, not shared, and is debug. Since it is not compile method 1 or 2, I have not added the `wx-config --cxxflags` or `wx-config --libs` (though I've tried this with compilation methods one and two) (BTW, I assume wx-config must lie in a directory in the PATH variable).
Global variables
$(#wx) = C:\dev\wxMSW-2.9.1 (install directory for wxWidgets)
include, lib, bin, cFlags, lFlags left blank
CB Env variables
PATH includes C:\dev\wxMSW-2.9.1\include;C:\dev\wxMSW-2.9.1\lib\gcc_lib
Global compiler settings
compiler flags (not sure what these do, but suggested in some docs)
-pipe
-mthreads
[[if (PLATFORM == PLATFORM_MSW && (GetCompilerFactory().GetCompilerVersionString(_T("gcc")) >= _T("4.0.0"))) print(_T("-Wno-attributes")]]
compiler defines (also tried setting WXUSINGDLL wxUSE_UNICODE for those builds)
__GNUWIN32__
__WXMSW__
__WXDEBUG__
linker settings/libraries (all libs in the gcc_dll directory) such as
C:\dev\wxMSW-2.9.1\lib\gcc_lib\libwxzlibd.a
C:\dev\wxMSW-2.9.1\lib\gcc_lib\libwxbase29d_net.a
etc . . .
linker settings / other options
-mthreads
Search directories / compiler
$(#wx)\include (have also tried $(#wx.include))
$(#wx)\lib\gcc_dll\mswd
$(#wx)\contrib\include
search directories / linker
$(#wx)\lib\gcc_lib
search directories / resource compiler
$(#wx)\lib\gcc_lib
$(#wx)\include
$(#wx)\lib\gcc_lib\mswd
What am I missing? This is driving me to alcohol so any help is appreciated.
Thanks.