Id returned 1 exit status - CodeBlocks with wxWidg

2019-09-21 07:54发布

问题:

I have installed wxWidgets for Code::Blocks, watched a tutorial on YouTube on how to do this, everything seemed fine. I created a new project, but I can't compile. I get an error. This is how a project looks when I create it, and I do not change nothing in it.

Project when I created it

And here is the error.

ld.exe cannot find -lwxmsw28u

回答1:

1) In order to make it work, you need to go to settings-->Global Variables. My home directory for wxWidgets is C:\wxWidgets-3.1.0-tdmgcc32 and this is compiled with gcc.

Base: C:\wxWidgets-3.1.0-tdmgcc32

include: C:\wxWidgets-3.1.0-tdmgcc32\include (basically where include dir is)

lib: C:\wxWidgets-3.1.0-tdmgcc32\lib\gcc_dll (where all your library files (dll,.a or .lib) are located)

2) New Project-->wxWidgets project. Here make sure that if you have compiled wxWidgets as monolithic, select wxWidgets is built as monolithic library

3) go to Project-->Build Options...

Apply the following settings to Release. For Debug, mswu should be mswud. If you compiled wxWidgets with Visual Studio, then instead of lib/gcc_dll, you should see lib/vc_dll

If you follow the steps and apply them correctly, it should work.

Notes:

1) if you have not compiled wxWidgets as monolithic, then instead of libwxmsw31u.a under lib gcc_dll directory, you might see different names, just include them for now, later on you can be selective.

2) libwxmsw31u.a is for the release version and libwxmsw31ud.a is for Debug version. Make sure, you include correct files in the debug and release versions.