Getting wxglcanvas test program to run ubuntu with code::blocks

Ok… so I’ve been wanting to get my own custom app that uses opencascade, wxwidgets and linux code::blocks with eventual ports to windows.    There is a very nice OSS application called heekscad that can be consulted for reference.

I believe to set up an Opengl window using wxwidgets  WxGlCanvas is what I need.  I found some non-occ sample code just to figure out how WxGlcanvas ticks.   I found some references to it in HeeksCAD

[Edit.. Scroll to the bottom for what works… I was barking up a lot of wrong trees here.]

I think I need to explore Opengl a little bit before I go much further into the OCC stuff.

Actually, I think I need to back up a little further.
I loaded up the subclasswxglcanvas.cpp sample code and I’m getting the following errors:

obj/Debug/subclasswxglcanvas.o||In function __static_initialization_and_destruction_0':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to
wxEventHashTable::wxEventHashTable(wxEventTable const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to wxEVT_PAINT'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to
wxEVT_NULL’|
obj/Debug/subclasswxglcanvas.o||In function __tcf_1':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to
wxEventHashTable::~wxEventHashTable()’|
obj/Debug/subclasswxglcanvas.o||In function main':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to
wxEntry(int&, char**)’|
obj/Debug/subclasswxglcanvas.o||In function wxCreateApp()':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to
wxAppConsole::CheckBuildOptions(char const*, char const*)’|
obj/Debug/subclasswxglcanvas.o||In function wxGLCanvasSubClass::Render()':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|51|undefined reference to
wxGLCanvas::SetCurrent()’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|52|undefined reference to wxPaintDC::wxPaintDC(wxWindow*)'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|53|undefined reference to
glClearColor’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|54|undefined reference to glClear'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|55|undefined reference to
glViewport’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|57|undefined reference to glBegin'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|58|undefined reference to
glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|59|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|60|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|61|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|62|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|63|undefined reference to glColor3f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|64|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|65|undefined reference to glEnd'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|67|undefined reference to
glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|68|undefined reference to glColor3f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|69|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|70|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|71|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|72|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|73|undefined reference to
glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|76|undefined reference to glColor4f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to
glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|79|undefined reference to glLoadIdentity'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|80|undefined reference to
glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to glutWireTeapot'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|84|undefined reference to
glFlush’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|85|undefined reference to wxGLCanvas::SwapBuffers()'|
obj/Debug/subclasswxglcanvas.o||In function
wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxNullPalette'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxDefaultSize’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxDefaultPosition'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to wxConvLibc'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to
glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to wxGLCanvas::~wxGLCanvas()'|
obj/Debug/subclasswxglcanvas.o||In function
MyApp::OnInit()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|100|undefined reference to wxFrameNameStr'|
obj/Debug/subclasswxglcanvas.o||In function
wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxNullPalette'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxDefaultSize’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxDefaultPosition'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to wxConvLibc'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to
glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to wxGLCanvas::~wxGLCanvas()'|
obj/Debug/subclasswxglcanvas.o||In function
wxStringBase::Init()’:|
/usr/include/wx-2.8/wx/string.h|270|undefined reference to wxEmptyString'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

I think I need to research this doc as to what is going on

The issue has to do with static and dynamic libraries where I found a reasonable explanation of the difference here:

This document pretty much explain what the problem is, only thing is I'm a little too tired have this sink in.  Perhaps a quick read tonight and a re-read over a cup of coffee.

http://www.nsnam.org/docs/linker-problems.doc

Ok.. I forgot to save some stuff and I need to retrace my steps....

I copied  subclasswxglcanvas.cpp from http://wiki.wxwidgets.org/WxGLCanvas and setup up code blocks
Build Options>Compiler Settings>Other options:
wx-config –cxxflags

Build Options>Linker Settings>Other Linker Options>Other linker options: wx-config –libs

Ok... So when I do that I get this:
obj/Debug/subclasswxglcanvas.o||In function
wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|51|undefined reference to wxGLCanvas::SetCurrent()'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|53|undefined reference to
glClearColor’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|54|undefined reference to glClear'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|55|undefined reference to
glViewport’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|57|undefined reference to glBegin'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|58|undefined reference to
glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|59|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|60|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|61|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|62|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|63|undefined reference to glColor3f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|64|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|65|undefined reference to glEnd'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|67|undefined reference to
glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|68|undefined reference to glColor3f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|69|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|70|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|71|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|72|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|73|undefined reference to
glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|76|undefined reference to glColor4f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to
glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|79|undefined reference to glLoadIdentity'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|80|undefined reference to
glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to glutWireTeapot'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|84|undefined reference to
glFlush’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|85|undefined reference to wxGLCanvas::SwapBuffers()'|
obj/Debug/subclasswxglcanvas.o||In function
wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to
glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to wxGLCanvas::~wxGLCanvas()'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to glutInit'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to
wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o:(.rodata+0xc8)||undefined reference to wxGLCanvas::sm_eventTable'|
obj/Debug/subclasswxglcanvas.o||In function
~wxGLCanvasSubClass’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|17|undefined reference to wxGLCanvas::~wxGLCanvas()'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|17|undefined reference to
wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o:(.rodata._ZTV18wxGLCanvasSubClass[vtable for wxGLCanvasSubClass]+0x8)||undefined reference to wxGLCanvas::GetClassInfo() const'|
obj/Debug/subclasswxglcanvas.o:(.rodata._ZTV18wxGLCanvasSubClass[vtable for wxGLCanvasSubClass]+0x1d8)||undefined reference to
wxGLCanvas::OnInternalIdle()’|
obj/Debug/subclasswxglcanvas.o:(.rodata._ZTI18wxGLCanvasSubClass[typeinfo for wxGLCanvasSubClass]+0x8)||undefined reference to typeinfo for wxGLCanvas'|
||=== Build finished: 39 errors, 0 warnings ===|

When I googled someone in the code:blocks forum with the same pain.
http://forums.codeblocks.org/index.php?topic=5769.0

So... I followed this thread... Basically I changed
Build Options>Linker Settings>Other Linker Options>Other linker options:
wx-config –libs

To
Build Options>Linker Settings>Other Linker Options>Other linker options:
wx-config –libs –gl-libs

I get this:
obj/Debug/subclasswxglcanvas.o||In function
wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to glutWireTeapot'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to
glutWireTeapot’|
obj/Debug/subclasswxglcanvas.o||In function wxGLCanvasSubClass':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to
glutInit’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to glutInit'|
||=== Build finished: 4 errors, 0 warnings ===|

Great.... The thread stops there. But supposed on the forum he posts further :(
Couldn't find it...

found some stuff here looks like I need to link to glut somehow...

http://www.nabble.com/Linker-Errors-For-OpenGL---GLUT-%27Hello-World%27-Program.-td19449213.html

Oh.... hear is a tutorial on code::blocks with some specific issues regarding glut...
This is worth looking at:http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/

Ok.... This is weird... The error seems to have moved a bit... Not sure what I did but now I'm getting this error:

-------------- Build: Debug in opengltests ---------------

Compiling: subclasswxglcanvas.cpp
Linking console executable: bin/Debug/opengltests
: 1: Syntax error: EOF in backquote substitution
Process terminated with status 2 (0 minutes, 4 seconds)
0 errors, 0 warnings

Go... Figure.. What is that all about..
Duh.... http://www.developpez.net/forums/d650304/c-cpp/cpp/debuter/syntax-error-eof-in-backquote-substitution/

Ok... This is getting closer

http://www.linuxquestions.org/questions/linux-software-2/help-me-solve-glut-devel-dependencys-185369/

Ok.... I think I've come full circle now.

I made the following change:
Build Options>Linker Settings>Other Linker Options>Other linker options:
wx-config –libs –gl-libs –lglut and I got this message:

obj/Debug/subclasswxglcanvas.o||In function __static_initialization_and_destruction_0′:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to wxEventHashTable::wxEventHashTable(wxEventTable const&)'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to
wxEVT_PAINT’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|28|undefined reference to wxEVT_NULL'|
obj/Debug/subclasswxglcanvas.o||In function
__tcf_1′:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|26|undefined reference to wxEventHashTable::~wxEventHashTable()'|
obj/Debug/subclasswxglcanvas.o||In function
main’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to wxEntry(int&, char**)'|
obj/Debug/subclasswxglcanvas.o||In function
wxCreateApp()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|95|undefined reference to wxAppConsole::CheckBuildOptions(char const*, char const*)'|
obj/Debug/subclasswxglcanvas.o||In function
wxGLCanvasSubClass::Render()’:|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|51|undefined reference to wxGLCanvas::SetCurrent()'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|52|undefined reference to
wxPaintDC::wxPaintDC(wxWindow*)’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|53|undefined reference to glClearColor'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|54|undefined reference to
glClear’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|55|undefined reference to glViewport'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|57|undefined reference to
glBegin’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|58|undefined reference to glColor3f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|59|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|60|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|61|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|62|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|63|undefined reference to
glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|64|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|65|undefined reference to
glEnd’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|67|undefined reference to glBegin'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|68|undefined reference to
glColor3f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|69|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|70|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|71|undefined reference to glVertex2f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|72|undefined reference to
glVertex2f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|73|undefined reference to glEnd'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|76|undefined reference to
glColor4f’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|77|undefined reference to glutWireTeapot'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|79|undefined reference to
glLoadIdentity’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|80|undefined reference to glColor4f'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|81|undefined reference to
glutWireTeapot’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|84|undefined reference to glFlush'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|85|undefined reference to
wxGLCanvas::SwapBuffers()’|
obj/Debug/subclasswxglcanvas.o||In function wxGLCanvasSubClass':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxNullPalette’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxDefaultSize'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxDefaultPosition’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to
wxConvLibc’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to glutInit'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to
wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o||In function MyApp::OnInit()':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|100|undefined reference to
wxFrameNameStr’|
obj/Debug/subclasswxglcanvas.o||In function wxGLCanvasSubClass':|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxNullPalette’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxDefaultSize'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to
wxDefaultPosition’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|31|undefined reference to wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette const&)'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|33|undefined reference to
wxConvLibc’|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|41|undefined reference to glutInit'|
/home/jonas/wx_opengl_experiments/opengltests/subclasswxglcanvas.cpp|42|undefined reference to
wxGLCanvas::~wxGLCanvas()’|
obj/Debug/subclasswxglcanvas.o||In function wxStringBase::Init()':|
/usr/include/wx-2.8/wx/string.h|270|undefined reference to
wxEmptyString’|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options…|
||=== Build finished: 50 errors, 0 warnings ===|

So…. This brings me back to this page.
http://ubuntuforums.org/showthread.php?p=5907768

I think I must be missing something very options here….
WxWiki says.
This compiled and worked with ‘g++ main.cpp -o gl Wx-Config --libs --cxxflags --gl-libs‘ (note the extra flag for Wx-Config) plus your platform’s flags to link against OpenGL and GLUT.

Hmm.
Found a link on the ubuntu forum:

http://ubuntuforums.org/showthread.php?t=296421

which pointed me here

I wound up posting on wxforums…

Basically, I had my linker settings messed up..
So in summary:

For the sample code found at http://wiki.wxwidgets.org/WxGLCanvas,

On Ubuntu 8.04, using code::blocks the following settings will get the thing running.

project>Build Options>Compiler Settings>Other Options:wx-config --cxxflags
project>Build Options>Linker Settng>Other Linking Options>
wx-config --libs --gl-libs -lGL -lglut

This entry was posted in Uncategorized. Bookmark the permalink.

5 Responses to Getting wxglcanvas test program to run ubuntu with code::blocks

  1. Geoff says:

    Legend. I am just trying to get figure wx and gl to write a *basic* 3D cad program and ran straight into this problem running the wxGLCanvas example. I am really glad you took the time to document your solution.

  2. admin says:

    Your welcome….

  3. Lahiru says:

    Thanks a lot!

  4. Nate says:

    Thanks a lot, this should be in the wiki!

    For people with this problem, when using the advice at the end of this post, make sure you use double hyphens for the wx-config parameters – in my browser it shows up as
    wx-config -cxxflags
    when it should be
    wx-config --cxxflags
    I think this website has some autoformat settings that are to blame.

  5. admin says:

    Big huh… It seems to be double hypens when I’m looking at it. Thanks for pointing that out.

Leave a Reply

Your email address will not be published. Required fields are marked *