Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / linker fails after following simple example - wxWindows & DevCpp

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. linker fails after following simple example - wxWindows & DevCpp
#3289
Posted by: 2004-01-31 12:12:53
HI,

(newbie to devcpp so please bare with me)

Followed this guide several times over - and I've also tried changing the order in which libraries are given in the Project Options & Compiler Environment but still end up with a bunch of what look to be undefinedreference to WxWindows library calls in the Linker tab of DevC++.

http://www.wxwindows.org/devcpp.htm

I've downloaded DevC++ ver4 and WxWindows 2.4.2 and followed the above guide religously and then experimented with library locations and order.

I think I'm inches away from actually getting this stuff setup, but pulling my hair out now. I'm sure this may have been asked before on this forum, but I've yet to find it in searching.

I'm assuming the build went ok... it finished without apparent error when building wxWin, although none of the copy commands such as copying setup.h or y_tab.c worked unless I did it manually. I dont think this is relevant to this problem... as the libraries exist in wxWin242lib:


Appreciate any help,
Mike.

Example linker failures...
c:/wxWin242/lib/libwxmswd.a(window.o): In function `wxWindow::SetDropTarget(wxDropTarget *)':
//C/wxWin242/src/msw/../../src/msw/window.cpp:1526: undefined reference to `wxDropTarget::Revoke(unsigned long)'
//C/wxWin242/src/msw/../../src/msw/window.cpp:1532: undefined reference to `wxDropTarget::Register(unsigned long)'
c:/wxWin242/lib/libwxmswd.a(window.o): In function `wxWindow::HandleDestroy(void)':
//C/wxWin242/src/msw/../../src/msw/window.cpp:3318: undefined reference to `wxDropTarget::Revoke(unsigned long)'
c:/wxWin242/lib/libwxmswd.a(clipbrd.o): In function `wxClipboard::AddData(wxDataObject *)':
//C/wxWin242/src/msw/../../src/msw/clipbrd.cpp:628: undefined reference to `wxDataObject::SetAutoDelete(void)'
c:/wxWin242/lib/libwxmswd.a(clipbrd.o): In function `wxClipboard::GetData(wxDataObject &)':
//C/wxWin242/src/msw/../../src/msw/clipbrd.cpp:765: undefined reference to `wxDataObject::GetFormatName(wxDataFormat)'
c:/wxWin242/lib/libwxmswd.a(enhmeta.o): In function `wxStringData::Unlock(void)':
//C/wxWin242/src/msw/../../include/wx/string.h(.text$__23wxEnhMetaFileDataObject+0xf): undefined reference to `wxDataObject::wxDataObject(void)'
//C/wxWin242/src/msw/../../include/wx/string.h(.text$__23wxEnhMetaFileDataObjectRC13wxEnhMetaFile+0x13): undefined reference to `wxDataObject::wxDataObject(void)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_29wxEnhMetaFileSimpleDataObject+0x24): undefined reference to `wxDataObject::GetSizeFromBuffer(void const *, unsigned int *, wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_29wxEnhMetaFileSimpleDataObject+0x28): undefined reference to `wxDataObject::SetSizeInBuffer(void *, unsigned int, wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_29wxEnhMetaFileSimpleDataObject+0x2c): undefined reference to `wxDataObject::GetBufferOffset(wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_23wxEnhMetaFileDataObject+0x24): undefined reference to `wxDataObject::GetSizeFromBuffer(void const *, unsigned int *, wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_23wxEnhMetaFileDataObject+0x28): undefined reference to `wxDataObject::SetSizeInBuffer(void *, unsigned int, wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_23wxEnhMetaFileDataObject+0x2c): undefined reference to `wxDataObject::GetBufferOffset(wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.text$_$_23wxEnhMetaFileDataObject+0x25): undefined reference to `wxDataObject::~wxDataObject(void)'
//C/wxWin242/src/msw/../../include/wx/string.h(.text$_$_18wxDataObjectSimple+0x14): undefined reference to `wxDataObject::~wxDataObject(void)'
//C/wxWin242/src/msw/../../include/wx/string.h(.text$__18wxDataObjectSimpleRC12wxDataFormat+0x13): undefined reference to `wxDataObject::wxDataObject(void)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_18wxDataObjectSimple+0x24): undefined reference to `wxDataObject::GetSizeFromBuffer(void const *, unsigned int *, wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_18wxDataObjectSimple+0x28): undefined reference to `wxDataObject::SetSizeInBuffer(void *, unsigned int, wxDataFormat const &)'
//C/wxWin242/src/msw/../../include/wx/string.h(.data$__vt_18wxDataObjectSimple+0x2c): undefined reference to `wxDataObject::GetBufferOffset(wxDataFormat const &)'



Example compilation commands...
Building resource file...
Compiling files :
C:DEV-C_~1BINg++ "d:swdevcppprojectstestproject1test1.cpp" -c -fdollars-in-identifiers -fsave-memoized -s -mwindows -fexpensive-optimizations -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -Wall -fvtable-thunks -D__WXMSW__ -D__GNUWIN32__ -DWINVER=0x400 -D__WIN95__ -DSTRICT -D__WXDEBUG__ -IC:DEV-C_~1INCLUDE -IC:DEV-C_~1INCLUDEG__~1 -IC:DEV-C_~1INCLUDE -LC:DEV-C_~1LIB -Lc:WXWIN242LIB -BC:DEV-C_~1BIN -Ic:WXWIN242INCLUDE -Ic:WXWIN242LIBMSWD
Linking files :
C:DEV-C_~1BINg++ "d:swdevcppprojectstestproject1test1.o" -o d:swdevcpp~1testpr~1Projec~1.exe -lwxmswd -lcomdlg32 -luser32 -lgdi32 -lole32 -lwsock32 -lcomctl32 -lctl3d32 -lgcc -lstdc++ -lshell32 -loleaut32 -ladvapi32 -luuid -Lc:wxWin242lib D:SWDEVCPP~1TESTPR~1RSRC.o -fdollars-in-identifiers -fsave-memoized -s -mwindows -fexpensive-optimizations -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -Wall -fvtable-thunks -D__WXMSW__ -D__GNUWIN32__ -DWINVER=0x400 -D__WIN95__ -DSTRICT -D__WXDEBUG__ -IC:DEV-C_~1INCLUDE -IC:DEV-C_~1INCLUDEG__~1 -IC:DEV-C_~1INCLUDE -LC:DEV-C_~1LIB -Lc:WXWIN242LIB -BC:DEV-C_~1BIN -Ic:WXWIN242INCLUDE -Ic:WXWIN242LIBMSWD



Example autoexec.bat env vars...
REM ------ DEV-C++ -------------------------------------------------
SET PATH=C:Dev-C++bin;C:homemikecmds;%PATH%
SET WXWIN=C:wxWin242
Message2. Re: linker fails after following simple example - wxWindows & DevCpp
#3290
Posted by: xburge03 2004-01-31 14:40:20
Are you using the default examle program to wxWindows? It works to me....

try this add to your Project:Prefereences:Parametres

to c++ compiler paste this:
-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DHAVE_W32API_H  -D__WXMSW__ -D__WINDOWS__ -Wall -fno-pcc-struct-return -O2 -Os -fno-rtti -fno-exceptions

to Linker add this:
-Wl,--subsystem,windows -mwindows -lwxmsw -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid 

To me it works...
Message3. Re: linker fails after following simple example - wxWindows & DevCpp
#3292
Posted by: 2004-01-31 22:52:51
I am using the default test example from the Dev-Cpp website (see URL in message).

It has a very very simple example at the end which 'hopefully' compiles according the author.  However, for me I can't get it to link.

I've tried the parameters above, but do not work.

Thanks anyway.
Mike.
Message4. Re: linker fails after following simple example - wxWindows & DevCpp
#3295
Posted by: upCASE 2004-02-01 02:56:09
Hi!
Although I can't think of a proper explanation of why these undefined references occour it seems to me that the errors don't point to a missing lib, but to errors and uncompiled stuff in the lib itself.
I'd really help in a another way, but currently all I can offer is my site a http://upcase.malteser-gl.de where you'll find another tutorial on compiling wxWindows, as well as two devpacks (but I do recommend compiling it yourself).

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message5. Re: linker fails after following simple example - wxWindows & DevCpp
#3301
Posted by: 2004-02-02 09:23:56
Hi,

Thanks for that... I realised I was compiling for 2.9-early... and you suggest 3 looks more appropriate!

But on compiling I see now a new compilation error, no such file for w32api.h when compiling dde.cpp and including gccpriv.h.

I have one, in my cygwin include dir... but I'm not trying to mess this installation up by pulling in completely different header file locations.

Any ideas... I will plugged away in the meantime.
Cheers,
Mike.
Message6. Re: linker fails after following simple example - wxWindows & DevCpp
#3302
Posted by: 2004-02-02 09:38:43
After reading the makeg95.env file comment above MINGW32VERSION=3.0 it says gcc 3.x provides this w32api.h file.

So I copied the w32api.h from my Cygwin installation which has gcc 3.2 into an include path of the wxWindows make process.

This got rid of the cannot find file... and replaced this error with :

dde.cpp:43:
winundef.h:219: parse error before '*'
...
In function int StartDoc(...):
'h' undeclared (first use of function).


Then a few more similar errors and bails out.  I will try to re-read your guide several times more, but maybe you've run into this kind of compilation headaches?

Cheers,
Mike.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,360.00 ·
 
 
¥271.00 ·
 
 
¥880.00 ·
 
 
¥980.00 ·
 
 
¥890.00 编辑
 
 
¥918.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0