Hi, I hope someone can help me with this problem, I've read as much as I can about it, but can find no difinitive solution.
I'm using Code::Blocks 1.0 RC2 with the MinGW compiler - this works fine.
I've installed wxWidgets and compiled them by:
cd C:\wxWidgets\build\msw
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 USE_XRC=1 UNICODE=0 VENDOR=cb
cd ..\..\contrib\build\stc
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 USE_XRC=1 UNICODE=0 VENDOR=cb
I've created a new wxWidgets project using the supplied template, but when building I get the following error:
cannot find -lwxmsw26
I've checked the project "build options", under "link libraries" wxmsw26 is listed. (I understand using this type of link lib is best)
However, I can't find libwxmsw.a in C:\wxWidgets\lib\gcc_dll
Any ideas?
Two questions:
- What version of wx did you compile? If it wasn't 2.6.* you might have to change that filename to reflect the library created.
- Did you add the lib's directory to the linker search path?
Hi,
I compiled version 2.6.2
As for the linker search path, I haven't added or changed anything manually. In Project>>Build Options>>Directories tab>>Linker tab I have:
$(WX_DIR)\lib\gcc_dll$(WX_CFG)
Quote from: Slider on December 05, 2005, 12:48:14 AM
Hi,
I compiled version 2.6.2
As for the linker search path, I haven't added or changed anything manually. In Project>>Build Options>>Directories tab>>Linker tab I have:
$(WX_DIR)\lib\gcc_dll$(WX_CFG)
Add to linker.
$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw
Add to compiler.
$(WX_DIR)\include
$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw
And change your WX_DIR to "C:\wxWidgets".
Your compiler defines should have WXUSINGDLL or something like that. I use static can't remerber what that option was....
Quote from: Seth Jackson on December 05, 2005, 12:53:25 AM
Quote from: Slider on December 05, 2005, 12:48:14 AM
Hi,
I compiled version 2.6.2
As for the linker search path, I haven't added or changed anything manually. In Project>>Build Options>>Directories tab>>Linker tab I have:
$(WX_DIR)\lib\gcc_dll$(WX_CFG)
Add to linker.
$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw
Add to compiler.
$(WX_DIR)\include
$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw
And change your WX_DIR to "C:\wxWidgets".
Your compiler defines should have WXUSINGDLL or something like that. I use static can't remerber what that option was....
Thanks for the suggestion, I've followed what you said, but its still throwing up the same error.
Could you attach your project file (*.cbp)?
Quote from: Seth Jackson on December 05, 2005, 01:05:56 AM
Could you attach your project file (*.cbp)?
Here it is, minus the corrections you suggested earlier.
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="wxWidgets application"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="C:\test\wxWidgets.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="0"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="0"/>
</Target>
<Environment>
<Variable name="WX_DIR" value="C:\wxWidgets"/>
<Variable name="WX_CFG" value=""/>
</Environment>
</Build>
<Compiler>
<Add option="-pipe"/>
<Add option="-mthreads"/>
<Add option="-Winvalid-pch"/>
<Add option="-include "wx_pch.h""/>
<Add option="-D__GNUWIN32__"/>
<Add option="-D__WXMSW__"/>
<Add option="-DWXUSINGDLL"/>
<Add option="-DUSE_PCH"/>
<Add directory="$(WX_DIR)\include"/>
<Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)\msw"/>
<Add directory="$(WX_DIR)\contrib\include"/>
</Compiler>
<ResourceCompiler>
<Add directory="$(WX_DIR)\include"/>
</ResourceCompiler>
<Linker>
<Add library="wxmsw26"/>
<Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)"/>
</Linker>
<Unit filename="wx_pch.h">
<Option compilerVar="CPP"/>
<Option link="0"/>
<Option weight="0"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
Quote from: Slider on December 05, 2005, 01:11:11 AM
Quote from: Seth Jackson on December 05, 2005, 01:05:56 AM
Could you attach your project file (*.cbp)?
Here it is, minus the corrections you suggested earlier.
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="wxWidgets application"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="C:\test\wxWidgets.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="0"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="0"/>
</Target>
<Environment>
<Variable name="WX_DIR" value="C:\wxWidgets"/>
<Variable name="WX_CFG" value=""/>
</Environment>
</Build>
<Compiler>
<Add option="-pipe"/>
<Add option="-mthreads"/>
<Add option="-Winvalid-pch"/>
<Add option="-include "wx_pch.h""/>
<Add option="-D__GNUWIN32__"/>
<Add option="-D__WXMSW__"/>
<Add option="-DWXUSINGDLL"/>
<Add option="-DUSE_PCH"/>
<Add directory="$(WX_DIR)\include"/>
<Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)\msw"/>
<Add directory="$(WX_DIR)\contrib\include"/>
</Compiler>
<ResourceCompiler>
<Add directory="$(WX_DIR)\include"/>
</ResourceCompiler>
<Linker>
<Add library="wxmsw26"/>
<Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)"/>
</Linker>
<Unit filename="wx_pch.h">
<Option compilerVar="CPP"/>
<Option link="0"/>
<Option weight="0"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
It seems like you still have not defined WX_DIR...
Go to Project > Build Options > Custom variables , Add a variable "WX_DIR" (without quotes), value as "C:\wxWidgets " (without quotes) , it should work now :)
WX_DIR is defined, according to the cbp file above:
...
<Variable name="WX_DIR" value="C:\wxWidgets"/>
...
Quote from: Slider on December 05, 2005, 04:06:29 PM
WX_DIR is defined, according to the cbp file above:
...
<Variable name="WX_DIR" value="C:\wxWidgets"/>
...
:oops: I use the search function to find in your .cbp file seems like I missed out ..
anyway , did you find your any library files under WX_DIR\lib\gcc_dll\ ? if not , try to search under WX_DIR with the file name wxmsw* see where it is . If cannot be found , maybe your compilation of wxwidgets is not successful.
When searching for wxmsw* nothing was found.
The follwing files are present in \lib\gcc_dll:
libwxexpat.a, libwxjpeg.a, libwxpng.a, libwxregex.a, libwxtiff.a, libwxzlib.a
The problem is really starting to annoy me. Thanks for your help.
Just copy your libwxmsw26.a to that directory. It should be there around somewhere... search for lib*wx*.a:
C:\> CD \wxWidgets
C:\wxWidgets> DIR lib*wx*.a /s /b
And tell us what you find.
No libwxmsw26.a was found in c:\wxWidgets, has something gone wrong when I compiled wxWidgets?
Quote from: Slider on December 05, 2005, 05:58:53 PM
When searching for wxmsw* nothing was found.
...
The problem is really starting to annoy me. Thanks for your help.
Check your wxWidgets build. If you don't have the wxMSW DLL (and import library) already built, how do you expect it to work? :shock:
I followed the instructions using mingw32-make to compile the libraries, no errors were encountered. Part of the problem is there are no definitive instructions for getting wxWidgets working with Code::Blocks - the Wiki says something different to the wxWidgets "instructions" posted in this forum.
ok, I've gone through the build again, but still no libwxmsw26.a is created anywhere.
very strange ... a question , do you have wxmsw26_gcc_cb.dll ?
One of the possibility may due to non-default wxwidgets installation path.
Try to add an OS environment variable in your windows (My computer right click> properties > Advanced > Environment variable , it may a bit different win2k & winxp )
set WX_DIR as c:\wxwidgets
Recompile wxwidgets (do a make clean before recompile)
Thanks for your suggestion cyberkoa, turns out it there was no environment variable for the MinGW compiler, putting it in place solved the problem. Thanks.
Can you be more specific with your fix please? I'm having the same issue. What particular environment variable did you set?
Quote from: sviten on December 16, 2005, 04:11:52 PM
Can you be more specific with your fix please? I'm having the same issue. What particular environment variable did you set?
Yeah a bunch of people are having trouble with this still. I'll make a new thread today in the compilation forum and make it obvious, like "How-To: Compile svn head C::B in Unicode configuration"
Quote from: 280Z28 on December 16, 2005, 04:13:34 PM
Yeah a bunch of people are having trouble with this still. I'll make a new thread today in the compilation forum and make it obvious, like "How-To: Compile svn head C::B in Unicode configuration"
That's great and I appreciate it but I think this thread is about compiling/linking other projects, not C::B.
OK, I found my issue. My issue was I could get it to compile correctly but it would not run ( as in "Process terminated with status 1" ). My solution was to copy the dll file into the path. To keep things clean, I copied it into the project folder.
Quote from: sviten on December 16, 2005, 05:59:36 PM
My solution was to copy the dll file into the path. To keep things clean, I copied it into the project folder.
You can also add the path of the dll(s) directory in the system path (environmental variable). This is useful if other applications used the same dll(s).
Michael