Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / OpenGL - wxGLCanvas -  undefined reference

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. OpenGL - wxGLCanvas -  undefined reference
#4868
Posted by: 2004-07-21 08:09:09
Hi,
I've been programming with wxWindows for about a month. Currently I'm trying to compile the OGL cube sample using Dev-C++. The linker gives me following errors:


cube.o(.text+0xf78):cube.cpp: undefined reference to `wxGLCanvas::sm_eventTable'
cube.o(.text+0xfa4):cube.cpp: undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, wxGLCanvas const*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'
cube.o(.text+0x1000):cube.cpp: undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, wxGLCanvas const*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'

and so on, even though I set USE_GL_CANVAS to 1 in setup.h. I included the following files: <wx/glcanvas.h>, <GL/gl.h>, <GL/glu.h>, and other wx header files. In linker options I have:
-Wl,--subsystem,windows -mwindows -lwxmsw -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid

Can someone help me? Thanx.

Message2. Re: OpenGL - wxGLCanvas -  undefined reference
#4873
Posted by: upCASE 2004-07-21 22:11:52
Hi!
I suppose you're using version 2.4.2.

"even though I set USE_GL_CANVAS to 1 in setup.h"
Good. Have you compiled the lib with this options activated, or have you just set the flag and then tried to compile the sample?
Normally this error comes from defining GL_CANVAS like you did, while the lib was compiled without it, meaning -> the object files for GL support are missing in the lib. Recompile it and it should be there. Optionally I think compiling and linking the needed files manually could work, too.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: OpenGL - wxGLCanvas -  undefined reference
#4883
Posted by: 2004-07-22 20:46:13
I recompiled the library with VC++ Intro version and I was able to compile OpenGL samples using VC++ (but I can't redistribute them because it's Intro version). However, when I try to compile the same samples using Dev-Cpp, it gives me too many linker errors, not just about OGL:

cube.o(.text+0x22):cube.cpp: undefined reference to `_imp__wxTextCtrlNameStr'
cube.o(.text+0x3a):cube.cpp: undefined reference to `_imp__wxDefaultValidator'
cube.o(.text+0xf8):cube.cpp: undefined reference to `wxString::Printf(char const*, ...)'

and so on. I even linked the same libraries that VC++ uses but that didn't work either. Is it possible that the library compiled with VC++ won't work with Dev-Cpp? Is there a way I could get compiled library with OGL support somewhere?
Message4. Re: OpenGL - wxGLCanvas -  undefined reference
#4887
Posted by: upCASE 2004-07-23 01:05:45
Hi!
Correct! VC and gcc libs are very different. Not only the libs, but the object file too. It's not possible to use them together...

I'm pretty sure my devpack contains a version with OpenGL support. Check www.upcase.de for that one. But, as allways, I recommend that you recompile the gcc lib yourself.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-7-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0