Hello all
I am trying to get up and running a wxWidgets example that also uses OpenGL. I downloaded compiled wxWidgets in form of wxPack. Before that I have been writing simple applications using widgets and also OpenGL ( separately ) without any major issues. If anywone has wxWidgets 3.0 installed, the example I am trying to get running is located in ...\wxWidgets3.0\samples\opengl\cube
When trying to build the example I get 15 errors, which are :
||=== Build: Debug in cubePrimercek (compiler: GNU GCC Compiler) ===|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|37|warning: "wxUSE_GLCANVAS" redefined [enabled by default]|
O:\SourceCode\Libraries\wxWidgets3.0\include\wx\setup.h|1318|note: this is the location of the previous definition| obj\Debug\cube.o||In function `ZN13TestGLContextC2EP10wxGLCanvas':|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|146|undefined reference to `wxGLContext::wxGLContext(wxGLCanvas*, wxGLContext const*)'|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|148|undefined reference to `wxGLContext::SetCurrent(wxGLCanvas const&) const'|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|146|undefined reference to `wxGLContext::~wxGLContext()'|obj\Debug\cube.o||In function `ZN12TestGLCanvasC2EP8wxWindowPi':|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|338|undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, int const*, wxPoint const&, wxSize const&, long, wxString const&, wxPalette const&)'|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|338|undefined reference to `wxGLCanvas::~wxGLCanvas()'|obj\Debug\cube.o||In function `ZN7MyFrameC2Eb':|
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|500|undefined reference to `wxGLCanvasBase::IsDisplaySupported(int const*)'|obj\Debug\cube.o:cube.cpp:(.rdata+0x248)||undefined reference to `wxGLCanvas::sm_eventTable'|obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[__ZTV12TestGLCanvas]+0x8)||undefined reference to `wxGLCanvas::GetClassInfo() const'|obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[__ZTV12TestGLCanvas]+0x368)||undefined reference to `wxGLCanvas::SwapBuffers()'|obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[__ZTV12TestGLCanvas]+0x370)||undefined reference to `wxGLCanvas::CreateDefaultPalette()'|obj\Debug\cube.o||In function `ZN12TestGLCanvasD1Ev':|
N:\projekticpp\wxWidgets\cubePrimercek\cube.h|66|undefined reference to `wxGLCanvas::~wxGLCanvas()'|
N:\projekticpp\wxWidgets\cubePrimercek\cube.h|66|undefined reference to `wxGLCanvas::~wxGLCanvas()'|obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV13TestGLContext[__ZTV13TestGLContext]+0x8)||undefined reference to `wxGLContext::GetClassInfo() const'|obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV13TestGLContext[__ZTV13TestGLContext]+0x1c)||undefined reference to `wxGLContext::SetCurrent(wxGLCanvas const&) const'|obj\Debug\cube.o||In function `ZN13TestGLContextD1Ev':|
N:\projekticpp\wxWidgets\cubePrimercek\cube.h|18|undefined reference to `wxGLContext::~wxGLContext()'|
||=== Build failed: 15 error(s), 1 warning(s) (0 minute(s), 9 second(s)) ===|
From what I know, the reason for these errors is not including "libwxmsw30u_gl.a" and "libwxmsw30ud_gl.a" . However I have included them both ( from "lib" and "lib64" folders ) to the linker settings -> link libraries in the CodeBlocks project. I have added the folders of these libraries to project -> search directories -> linker as well. And also to global CodeBlocks compiler settings in search directories -> linker. But the errors persist. I don't know why these libraries don't get linked to the project, since the build log writes them out. Here it is in the first anaconda line ( sorry I didn't find how to make it more readable ) :
-------------- Build: Debug in cubePrimercek (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\MinGW\lib" -LO:\SourceCode\Libraries\wxWidgets3.0\lib\gcc_dll -LO:\SourceCode\Libraries\wxWidgets3.0\lib\gcc48_lib -LO:\SourceCode\Libraries\wxWidgets3.0\lib64\gcc48_dll -LO:\SourceCode\Libraries\wxWidgets3.0\lib64\gcc48_lib -LO:\SourceCode\Libraries\wxWidgets3.0\lib\gcc_dll -LN:\opencv\build\x86\mingw\lib -LO:\SourceCode\Libraries\wxWidgets3.0\lib\gcc48_lib -LO:\SourceCode\Libraries\wxWidgets3.0\lib64\gcc48_lib -o bin\Debug\cubePrimercek.exe obj\Debug\cube.o obj\Debug\resource.res -mthreads -lwxmsw30u -lopengl32 -lglu32 O:\SourceCode\Libraries\wxWidgets3.0\lib64\gcc48_lib\libwxmsw30ud_gl.a O:\SourceCode\Libraries\wxWidgets3.0\lib64\gcc48_lib\libwxmsw30u_gl.a O:\SourceCode\Libraries\wxWidgets3.0\lib\gcc48_lib\libwxmsw30ud_gl.a O:\SourceCode\Libraries\wxWidgets3.0\lib\gcc48_lib\libwxmsw30u_gl.a N:\opencv\build\x86\mingw\lib\libopencv_calib3d_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_calib3d246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_contrib_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_contrib246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_core_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_core246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_features2d_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_features2d246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_flann_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_flann246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_gpu_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_gpu246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_haartraining_engine.a N:\opencv\build\x86\mingw\lib\libopencv_highgui_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_highgui246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_imgproc_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_imgproc246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_legacy_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_legacy246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_ml_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_ml246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_nonfree_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_nonfree246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_objdetect_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_objdetect246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_perf_calib3d_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_core_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_features2d_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_gpu_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_highgui_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_imgproc_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_nonfree_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_objdetect_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_photo_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_stitching_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_superres_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_perf_video_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_photo_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_photo246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_stitching_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_stitching246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_superres_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_superres246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_test_calib3d_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_contrib_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_core_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_features2d_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_flann_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_gpu_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_highgui_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_imgproc_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_legacy_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_ml_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_nonfree_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_objdetect_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_photo_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_stitching_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_superres_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_test_video_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_ts_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_ts246.a N:\opencv\build\x86\mingw\lib\libopencv_video_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_video246.dll.a N:\opencv\build\x86\mingw\lib\libopencv_videostab_pch_dephelp.a N:\opencv\build\x86\mingw\lib\libopencv_videostab246.dll.a -mwindows
obj\Debug\cube.o: In function `ZN13TestGLContextC2EP10wxGLCanvas':
N:/projekticpp/wxWidgets/cubePrimercek/cube.cpp:147: undefined reference to `wxGLContext::wxGLContext(wxGLCanvas*, wxGLContext const*)'
N:/projekticpp/wxWidgets/cubePrimercek/cube.cpp:149: undefined reference to `wxGLContext::SetCurrent(wxGLCanvas const&) const'
N:/projekticpp/wxWidgets/cubePrimercek/cube.cpp:147: undefined reference to `wxGLContext::~wxGLContext()'
obj\Debug\cube.o: In function `ZN12TestGLCanvasC2EP8wxWindowPi':
N:/projekticpp/wxWidgets/cubePrimercek/cube.cpp:339: undefined reference to `wxGLCanvas::wxGLCanvas(wxWindow*, int, int const*, wxPoint const&, wxSize const&, long, wxString const&, wxPalette const&)'
N:/projekticpp/wxWidgets/cubePrimercek/cube.cpp:339: undefined reference to `wxGLCanvas::~wxGLCanvas()'
obj\Debug\cube.o: In function `ZN7MyFrameC2Eb':
N:/projekticpp/wxWidgets/cubePrimercek/cube.cpp:501: undefined reference to `wxGLCanvasBase::IsDisplaySupported(int const*)'
obj\Debug\cube.o:cube.cpp:(.rdata+0x248): undefined reference to `wxGLCanvas::sm_eventTable'
obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[__ZTV12TestGLCanvas]+0x8): undefined reference to `wxGLCanvas::GetClassInfo() const'
obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[__ZTV12TestGLCanvas]+0x368): undefined reference to `wxGLCanvas::SwapBuffers()'
obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[__ZTV12TestGLCanvas]+0x370): undefined reference to `wxGLCanvas::CreateDefaultPalette()'
obj\Debug\cube.o: In function `ZN12TestGLCanvasD1Ev':
N:/projekticpp/wxWidgets/cubePrimercek/cube.h:65: undefined reference to `wxGLCanvas::~wxGLCanvas()'
N:/projekticpp/wxWidgets/cubePrimercek/cube.h:65: undefined reference to `wxGLCanvas::~wxGLCanvas()'
obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV13TestGLContext[__ZTV13TestGLContext]+0x8): undefined reference to `wxGLContext::GetClassInfo() const'
obj\Debug\cube.o:cube.cpp:(.rdata$_ZTV13TestGLContext[__ZTV13TestGLContext]+0x1c): undefined reference to `wxGLContext::SetCurrent(wxGLCanvas const&) const'
obj\Debug\cube.o: In function `ZN13TestGLContextD1Ev':
N:/projekticpp/wxWidgets/cubePrimercek/cube.h:17: undefined reference to `wxGLContext::~wxGLContext()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 3 second(s))
15 error(s), 0 warning(s) (0 minute(s), 3 second(s))
I am using CodeBlocks 13.12 on a Windows 7 x64 machine. Although I have been doing both wxWidgets and OpenGL projects in CodeBlocks before, they were really simple. So I am still a beginner and any kind of help and extra info will be very much appreciated.
Thank you ! :)
T
You likely need to post on the wxWidgets forum. Edit http://forums.wxwidgets.org/ (http://forums.wxwidgets.org/)
And, remember to post the Build Log NOT the "message log" on that site and also this site in the future.
Edit2: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Step 1 is to figure out what caused this message!!!!!
N:\projekticpp\wxWidgets\cubePrimercek\cube.cpp|37|warning: "wxUSE_GLCANVAS" redefined [enabled by default]|
Tim S.
If you posted a full rebuild log some one could help; since you can NOT no one can help you.
Try reading this FAQ!!!!!!!!! http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
You ARE wrong redefining the value of wxUSE_CANVAS is likely the cause of the problem!!!!
Where is it defined as zero?
Please learn to compile wxWidgets!! Please learn to ask your wxWidgets questions in the wxWidgets forum!!
From the sample; please read the errors you get instead of trying to hide them!!!!!!
#if !wxUSE_GLCANVAS
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
#endif
Tim S.