Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Problems linking Dev-C++ and wxWindows 2.4.2

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Problems linking Dev-C++ and wxWindows 2.4.2
#2678
Posted by: fparks 2003-09-26 23:41:46
I finally got wxWindows 2.4.2 compiled and reasonably tested (I didn't manually compile all of the samples, but a lot of them and only had one not work).

Now I try and compile using Dev-C++ 4.9.8.1.  I got the compile to work clean, but I get all kinds of linking errors.  I feel that this is a forest and the trees thing where I just can't spot the error.

Directory Structure:

C:wx2

to compile the menu sample in C:wx2samplesmenu after setting my path to "set PATH=%PATH%;c:dev-cppbin;c:cygwinbin

I used: mingw32-make -f makefile-g95 FINAL=1

The output from the compile is:

g++ -c  -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -I../../lib/msw -I../../include -I../../contrib/include -I../../src/regex -I../../src/png -I../../src/jpeg -I../../src/zlib -I../../src/tiff          -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__  -Wall -O2 -fno-rtti -fno-exceptions   -o menu.o menu.cpp
windres --use-temp-file -i menu.rc -o menu_resources.o  --include-dir ../../include  --define __WIN32__ --define __WIN95__ --define __GNUWIN32__
g++  -Wl,--subsystem,windows -mwindows -L../../lib -L../../contrib/lib   -o menu.exe menu.o menu_resources.o  ../../lib/libwxmsw.a -lregex -lpng -ljpeg -lzlib -ltiff -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid 

The output using Dev-C++ is (boy do I wish they would let copy from this window):

Compiler: Default Compiler
Executing g++.exe
g++.exe "C:wx2samplesmenumenu.cpp" -o  "C:wx2samplesmenumenu.exe" -D_X86=1 -DWIN32 -D_WIN32  -D__WIN95__ -D__GNUWIN32__ -D__WIN32__  -DSTRICT -D__WXMSW__ -D__WINDOWS__ -fmessage-length=0  -fno-exceptions -Os -fno-rtti -pg -g3 -l"C:Dev-Cppincludec++" -l"C:Dev-Cppincludec++mingw32" -l"C:Dev-Cppincludec++backward" -l"C:Dev-Cppinclude" -l"C:wx2includewx" -l"C:wx2include" -L"C:Dev-Cpplib" -L"C:wx2lib" -L"C:wx2bin" -L"C:wx2contriblib" -lwxmsw -lregex -lpng -ljpeg -lzlib -ltiff -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid -lgmon
c:wx2lib/libwxmsw.a(app.o)(.text+0x58f):app.cpp: undefined reference to 'CreateBrushIndirect@4'
....

It appears that the during the link I have a problem with the / argument.

I then went and a found a WIKI on www.wxwindows.org: Dev-CPP Setup Guide

I followed those instructions and downloaded the MSYS from http://www.mingw.ord/download.shmtl

Made the changes to dev-c++ with the same results (except for my successfully compiled locations of wxWindows).  Everything went through the compile and stopped cold on the link just as before.

Help!
Message2. Re: Problems linking Dev-C++ and wxWindows 2.4.2
#2679
Posted by: 2003-09-27 02:56:28
Hi!
Have you tried linking to libgdi32.a?
Message3. Re: Problems linking Dev-C++ and wxWindows 2.4.2
#2680
Posted by: fparks 2003-09-27 03:26:39
I just added -lgdi32 to the link list.  The problem has shrunk tremendously.

Now my problem is with:

C:wx2lib/libwxmsw.a(filedlg.o)(.text+0x130a):filedlg.ccp undefined reference to 'GetSaveFileNameA@4) + about 5 similar.

C:wx2lib/libwxmsw.a(colordlg.o)(.text+0x5da):colordlg.ccp undefined reference to 'ChooseColorA@4)

C:wx2lib/libwxmsw.a(fontdlg.o)(.text+0x199):fontdlg.ccp undefined reference to 'ChooseColorA@4)

C:wx2lib/libwxmsw.a(cmndata.o)(.text+0x13f6):cmndata.ccp undefined reference to 'PrinDlgA@4)

I know this is an education problem on my part.  Where can I find the associations between the .o and the .a that they are contained in.

I'm just too used to other platforms that automatically find these for me.

Thanks,

Frank
Message4. Re: Problems linking Dev-C++ and wxWindows 2.4.2
#2681
Posted by: fparks 2003-09-28 02:39:07
Found the answer to this particular problem in http://g.yi.org/_scripts/file.php?f=10503&r=2330 and added -lcomdlg32.

The question still remains - Is there an xref to libraries and objects?

Thanks for the help upcase!
Message5. Re: Problems linking Dev-C++ and wxWindows 2.4.2
#2688
Posted by: 2003-09-29 23:34:14
Hi again!
It's not really an educational problem you're having :)
I don't think that there's a list or something like that out telling you which object file resides in what library. Normally it's not that interesting.
BUT: Try the Win32 API help helpfile. That's where all the important stuff is listed. There you can do a search for a specific function (not object file) like GetSaveFileName and you'll ind some info on it (usage etc.). There also should be some "quick info" telling you the correct library for that function in MSVC syntax (comdlg32.lib in that case).
Although I normaly use wxWindows when doing GUI stuff this helpfile has been handy more than one time :)

upcase
Message6. Re: Problems linking Dev-C++ and wxWindows 2.4.2
#2689
Posted by: fparks 2003-09-30 00:23:50
upcase

Thanks for the heads up on checking the Win32 API help file.  Unfortunately, I was trying to stay as far away as possible from Windowz, because I want it to be as cross-platform as possible but I guess I can't

Thanks again for your help,

Frank
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2023-1-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0