User forums > Help

CB setup for wxWidgets / windows

(1/2) > >>

robkai:
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.

stahta01:
http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

robkai:
I've been through every aspect of http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef, doesn't help.

I can build wxWidgets.  Codeblocks working, but problems linking the most basic wxSmith app.  it compiles ok, just doesn't seem to link properly (which I assume is an incorrect linker setup), following errors.  What simple think am I missing?


||=== test12, Debug ===|
||warning: auto-importing has been activated without --enable-auto-import specified on the command line.|
obj\Debug\test12App.o:test12App.cpp:(.rdata$_ZTV9test12App[vtable for test12App]+0x5c)||undefined reference to `wxApp::Initialize(int&, wchar_t**)'|
obj\Debug\test12App.o:test12App.cpp:(.rdata$_ZTV9test12App[vtable for test12App]+0xc8)||undefined reference to `wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*)'|
obj\Debug\test12App.o:test12App.cpp:(.rdata$_ZTV9test12App[vtable for test12App]+0xcc)||undefined reference to `wxAppConsoleBase::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)'|
)]+0x2c)||undefined reference to `wxString::ConvertStr(char const*, unsigned int, wxMBConv const&)'|
||Info: resolving vtable for __cxxabiv1::__si_class_type_info by linking to __imp___ZTVN10__cxxabiv120__si_class_type_infoE |
||Info: resolving vtable for __cxxabiv1::__vmi_class_type_info by linking to __imp___ZTVN10__cxxabiv121__vmi_class_type_infoE |
||Info: resolving vtable for __cxxabiv1::__class_type_info by linking to __imp___ZTVN10__cxxabiv117__class_type_infoE |
||Info: resolving std::cerr  by linking to __imp___ZSt4cerr |
||Info: resolving typeinfo for std::basic_streambuf<char, std::char_traits<char> > by linking to __imp___ZTISt15basic_streambufIcSt11char_traitsIcEE |
||=== Build finished: 4 errors, 1 warnings ===|

stahta01:
Turn on Full Compiler Logging

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Do a rebuild of the wxWidgets project and post the build log.
I should be able to spot what is wrong.

This is the method normally used under windows

--- Quote from: robkai on November 16, 2010, 07:08:54 pm ---
  3)  minGW32-make.  
     puts libs in $(#wx)/lib/gcc_dll, no wx-config, include is in $(#wx)/include


--- End quote ---

Tim S.

stahta01:
Full Build log of wxWidgets project.

My wxWidgets Base is H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ

Tim S.


--- Code: ---mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wno-attributes -Wall  -g  -Wmissing-include-dirs   -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\include -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\contrib\include -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\lib\gcc_dll\mswu -IC:\GreenApps\MinGW_CodeBlocks10_05\include -IH:\SourceCode\CBProjects\TestProjects\testwx29 -IH:\SourceCode\CBProjects\TestProjects\testwx29 -c H:\SourceCode\CBProjects\TestProjects\testwx29\testwx29App.cpp -o obj\Debug\testwx29App.o
cc1plus.exe: warning: H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\contrib\include: No such file or directory
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wno-attributes -Wall  -g  -Wmissing-include-dirs   -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\include -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\contrib\include -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\lib\gcc_dll\mswu -IC:\GreenApps\MinGW_CodeBlocks10_05\include -IH:\SourceCode\CBProjects\TestProjects\testwx29 -IH:\SourceCode\CBProjects\TestProjects\testwx29 -c H:\SourceCode\CBProjects\TestProjects\testwx29\testwx29Main.cpp -o obj\Debug\testwx29Main.o
cc1plus.exe: warning: H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\contrib\include: No such file or directory
windres.exe -i H:\SOURCE~1\CBPROJ~1\TESTPR~1\testwx29\resource.rc -J rc -o obj\Debug\resource.res -O coff -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\include -IH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\lib\gcc_dll\mswu -IH:\SOURCE~1\CBPROJ~1\TESTPR~1\testwx29 -IH:\SourceCode\CBProjects\TestProjects\testwx29
mingw32-g++.exe -LH:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.9.1-SJLJ\lib\gcc_dll  -o bin\Debug\testwx29.exe obj\Debug\testwx29App.o obj\Debug\testwx29Main.o  obj\Debug\resource.res  -mthreads  -lwxmsw29u  -mwindows
Output size is 771.77 KB
Process terminated with status 0 (0 minutes, 14 seconds)
0 errors, 2 warnings
 
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version