User forums > Help

Problem with linking libraries

<< < (3/3)

rickg22:
HUH? :shock:

-l"wxmsw26 wxmsw26_gl wxtiff wxjpeg wxpng wxzlib wxregex wxexpat kernel32 user32 gdi32 comdlg32 winspool winmm shell32 comctl32 ole32 oleaut32 uuid rpcrt4 advapi32 wsock32"

Dude, you put all the libraries in one BIG linker option!
You better drop all those, and add them ONE BY ONE.

Anonymous:
Ok, finally I have compiled the project. All libraries should be added separatly  Problems are solved, but I had one more adventure with linking.

I started new project in the Code::Blocks and then added libraries, and the compile log looked like below:

Project   : wxWidgets application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Dev-Cpp\Projects\4\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe   -pipe -mthreads -fno-pcc-struct-return -fno-rtti -fno-exceptions -D_X86_ -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DSTRICT -D__WXMSW__ -D__WINDOWS__  -Wall    -I"C:\Program Files\CodeBlocks\include" -IC:\Dev-Cpp\include -c main.cpp -o .objs\main.o
mingw32-g++.exe   -pipe -mthreads -fno-pcc-struct-return -fno-rtti -fno-exceptions -D_X86_ -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DSTRICT -D__WXMSW__ -D__WINDOWS__  -Wall    -I"C:\Program Files\CodeBlocks\include" -IC:\Dev-Cpp\include -c app.cpp -o .objs\app.o
mingw32-g++.exe    -L"C:\Program Files\CodeBlocks\lib" -LC:\Dev-Cpp\lib -o C:\Dev-Cpp\Projects\4\wxWidgets.exe .objs\main.o .objs\app.o        -lwxmsw -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid  -lwxmsw26 -lwxmsw26_gl -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32 -mwindows
C:\Program Files\CodeBlocks\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwxmsw
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 37 seconds)
0 errors, 0 warnings

Strange is that I didn't added all libraries from the log
-lwxmsw -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid  -lwxmsw26 -lwxmsw26_gl -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32

A added only libraries below:
-lwxmsw26 -lwxmsw26_gl -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32

So I removed all libraries I added in the linker options, and the compile log looks like below:

Project   : wxWidgets application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Dev-Cpp\Projects\4\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe   -pipe -mthreads -fno-pcc-struct-return -fno-rtti -fno-exceptions -D_X86_ -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DSTRICT -D__WXMSW__ -D__WINDOWS__  -Wall    -I"C:\Program Files\CodeBlocks\include" -IC:\Dev-Cpp\include -c main.cpp -o .objs\main.o
mingw32-g++.exe   -pipe -mthreads -fno-pcc-struct-return -fno-rtti -fno-exceptions -D_X86_ -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DSTRICT -D__WXMSW__ -D__WINDOWS__  -Wall    -I"C:\Program Files\CodeBlocks\include" -IC:\Dev-Cpp\include -c app.cpp -o .objs\app.o
mingw32-g++.exe    -L"C:\Program Files\CodeBlocks\lib" -LC:\Dev-Cpp\lib -o C:\Dev-Cpp\Projects\4\wxWidgets.exe .objs\main.o .objs\app.o        -lwxmsw -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid  -mwindows
C:\Program Files\CodeBlocks\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwxmsw
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 34 seconds)
0 errors, 0 warnings

I was confused, why code::blocks adds libraries by it self, and I remind my self, that there I had problems with starting new static wxWidgets project, there was no file wxwindows_static.cbm file, and someone on the forum sad that these who have the problem should copy this file from the url:

http://cvs.sourceforge.net/viewcvs.py/*checkout*/codeblocks/codeblocks/src/templates/win32/wxwidgets_static.cbp?rev=1.1

and save it in the code::blocks directory, and I found that these libraries are in this file
      <Linker>
         <Add library="wxmsw"/>
         <Add library="winspool"/>
         <Add library="winmm"/>
         <Add library="shell32"/>
         <Add library="comctl32"/>
         <Add library="ctl3d32"/>
         <Add library="odbc32"/>
         <Add library="advapi32"/>
         <Add library="wsock32"/>
         <Add library="opengl32"/>
         <Add library="glu32"/>
         <Add library="ole32"/>
         <Add library="oleaut32"/>
         <Add library="uuid"/>
      </Linker>

So if anyone has the same problem, just removed these lines from the wxwindows_static.cbp file. Thank you for the help.

rickg22:
Good. Now the problem is that you can't find "libwxmsw.a".

C:\Program Files\CodeBlocks\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwxmsw
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 34 seconds)
0 errors, 0 warnings

Now, there MUST be a libwxmsw.a file SOMEWHERE. You just have to add its folder to your linker directories in your project options. Don't give up, you're about to find it :)

Anonymous:
libwxmsw.a was in the wxWindows_static.cbp template, I had problems with starting new project with wxWidgets static library, because there was no wxWindows_static.cbp file in the template directory. So I copied it from the url
http://cvs.sourceforge.net/viewcvs.py/*checkout*/codeblocks/codeblocks/src/templates/win32/wxwidgets_static.cbp?rev=1.1
and in this file wxmsw was in the linker options. So I removed it from this file, and the problem was solved. Thank all of you for your help

Navigation

[0] Message Index

[*] Previous page

Go to full version