hakuna matata
hakuna matata

Reputation: 3327

wxSmith and Code::Blocks build error

I recently started to work on GUI using wxSmith on Code::Blocks 10.05, and when I run the project, I haven't written any code yet, just the OnClose function, and I when I build and run my project, I get 4 errors, cannot find -lwxmsw28d_core, cannot find -lwxbase28d, cannot find -lwxpngd, and cannot find -lwxzlibd. The build log is:

-------------- Build: Debug in gui-test ---------------

Compiling: gui_testMain.cpp
Linking executable: bin\Debug\gui-test.exe
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28d_core.a when searching for -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28d_core.a when searching for -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28d_core.a when searching for -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxbase28d.a when searching for -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxbase28d.a when searching for -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxbase28d.a when searching for -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxpngd.a when searching for -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxpngd.a when searching for -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxpngd.a when searching for -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxzlibd.a when searching for -lwxzlibd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxzlibd.a when searching for -lwxzlibd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxzlibd.a when searching for -lwxzlibd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxzlibd
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
4 errors, 0 warnings

What could be giving me the error? I'm using Code::Blocks on Windows. And I'm doing as a tutorial what this link is doing wxSmith Tutorial - Code::Blocks Wiki

NOTE: If it helps, I installed wxWidgets from wxPack, and in Code::Blocks, I made a Global Variable using the Global Variable Editor, where the base field has C:\SourceCode\Libraries\wxWidgets2.8, include field has C:\SourceCode\Libraries\wxWidgets2.8\include, and lib field has C:\SourceCode\Libraries\wxWidgets2.8\lib. The rest of the fields are empty, like the obj (i couldnt find obj folder), cflags, lflags, and user-defined fields are empty.

Upvotes: 2

Views: 2833

Answers (3)

sourabh grover
sourabh grover

Reputation: 19

while making a new project just check the option that wxwidget is built as a monolithic library with use wxwidget DLL option.! if already created project just add linker settings and compiler settings of the project (properties)

Upvotes: 0

moskito-x
moskito-x

Reputation: 11968

Looks as if you did not compile the correct Debug version of wxWidgets.

Look at your ...\wxWidgets\build\msw folder, is there a folder like

  • gc_mwsud (unicode debug)
  • gc_mswuddll (unicode debug shared)

and in your case a folder

  • gcc_mswd (debug)
  • gcc_mswddll (debug shared)

EDIT

Only for your special case

go to x:\wxWidgets\build\msw\ ( x == your drive)

change your x:\wxWidgets\build\msw\config.gcc like

....

# C compiler 
CC = gcc

# C++ compiler 
CXX = g++
....

# What type of library to build? [0,1]
SHARED = 0
....

# Compile Unicode build of wxWidgets? [0,1]
UNICODE = 0
....

# Type of compiled binaries [debug,release]
BUILD ?= debug
....

# Multiple libraries or single huge monolithic one? [0,1]
MONOLITHIC = 0

make with command. ONLY for your special case !!

x:\wxWidgets\build\msw>mingw32-make -f makefile.gcc

The normal way for the officially-supported Code::Blocks is

clean up the source:

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug clean

NOTE: Make sure you use exactly the same options for this step and for the build step below. The clean target uses these variables and only cleans the specified version of the generated object and library files. (It will not clean the intended files if these variables are not identical.)

NOTE: If you still have problems with compiling after cleaning, you could try to manually remove the gcc_mswd directory under the build\msw directory. This directory is the place where the object files are stored.

When everything is clean you can start compiling wxWidgets:

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug

NOTE: These options are the officially-supported Code::Blocks options. If you want another version of wxWidgets (debug or non-Unicode) you still have to make sure you build a MONOLITHIC version (one big DLL) for linking Code::Blocks.

Patience. This step takes time. Make sure there was no compilation error before you continue.

http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.6_to_develop_Code::Blocks_%28MSW%29

Upvotes: 1

VZ.
VZ.

Reputation: 22753

"Incompatible" almost certainly means that the library is a 32 bit file and you're using 64 bit compiler. Run file on both the library and one of the object files generated during your build from MinGW command line to confirm this.

If this is correct, the solution would be to add -m32 option to the compiler/linker command lines if they really generate 64 bit code by default. Or maybe just get a 32 bit version of the compiler.

Upvotes: 0

Related Questions