Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: LinuxhaxU on March 11, 2011, 12:48:23 am

Title: wxwidgets and opengl
Post by: LinuxhaxU on March 11, 2011, 12:48:23 am
I am trying to set up the glcanvas on a wxwidgets app I can run normal wxwidgets apps fine but when I put in glcanvas i get this:

||=== learning linking, Debug ===|
H:\mywxgl\mywxglMain.h|42|error: ISO C++ forbids declaration of 'wxGLCanvas' with no type|
H:\mywxgl\mywxglMain.h|42|error: expected ';' before '*' token|
H:\mywxgl\mywxglMain.cpp||In constructor 'learning_linkingFrame::learning_linkingFrame(wxWindow*, wxWindowID)':|
H:\mywxgl\mywxglMain.cpp|68|error: 'WX_GL_RGBA' was not declared in this scope|
H:\mywxgl\mywxglMain.cpp|69|error: 'WX_GL_DOUBLEBUFFER' was not declared in this scope|
H:\mywxgl\mywxglMain.cpp|70|error: 'WX_GL_DEPTH_SIZE' was not declared in this scope|
H:\mywxgl\mywxglMain.cpp|71|error: 'WX_GL_STENCIL_SIZE' was not declared in this scope|
H:\mywxgl\mywxglMain.cpp|73|error: 'GLCanvas1' was not declared in this scope|
H:\mywxgl\mywxglMain.cpp|73|error: expected type-specifier before 'wxGLCanvas'|
H:\mywxgl\mywxglMain.cpp|73|error: expected ';' before 'wxGLCanvas'|
H:\mywxgl\mywxglMain.cpp|67|warning: unused variable 'GLCanvasAttributes_1'|
||=== Build finished: 9 errors, 1 warnings ===|

I did not mess with the code at all this is just what it generated

I am using wxsmith, codeblocks 10.5 and wxWidgets2.8

It's probably a simple fix....thanks
Title: Re: wxwidgets and opengl
Post by: ollydbg on March 11, 2011, 01:33:16 am
which wx library did you ues?
You need a wxWidget library with OpenGL enabled. Mostly you need to build it yourself.
Title: Re: wxwidgets and opengl
Post by: LinuxhaxU on March 11, 2011, 02:17:02 am
thanks for the quick response I used wxPack http://wxpack.sourceforge.net/Main/Downloads (http://wxpack.sourceforge.net/Main/Downloads)   
the latest.
Title: Re: wxwidgets and opengl
Post by: ollydbg on March 11, 2011, 04:19:43 am
thanks for the quick response I used wxPack http://wxpack.sourceforge.net/Main/Downloads (http://wxpack.sourceforge.net/Main/Downloads)  
the latest.
wxpack seems dose not build with wxGLCanvas enabled. so you need to build a wx library yourself.

see:
http://sourceforge.net/projects/wxpack/forums/forum/595652/topic/3920373

it has opengl enabled. so you need to link to the specified library.
Title: Re: wxwidgets and opengl
Post by: LinuxhaxU on March 11, 2011, 05:12:28 am
the specified library? so wxpack does have it enable and Im not linking correctly?
Title: Re: wxwidgets and opengl
Post by: stahta01 on March 11, 2011, 03:40:59 pm
H:\mywxgl\mywxglMain.cpp|68|error: 'WX_GL_RGBA' was not declared in this scope|

Did YOU include the correct header "wx/glcanvas.h" in your source code?
And, are you positive you are using the wxWidgets compiled with GL enabled?

Turn on Full Compiler Logging http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

IIRC, Add the following to your source code; if you have the wrong wx library or compile include/search options it is should error out.
Code
#include <wx/defs.h>
#if !wxUSE_GLCANVAS
    #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
#endif

Tim S.
Title: Re: wxwidgets and opengl
Post by: LinuxhaxU on March 11, 2011, 08:57:36 pm
H:\mywxgl\mywxglMain.h|14|error: #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"|\

thanks for the help I guess this means I have to build wxWidgets my self?

Title: Re: wxwidgets and opengl
Post by: stahta01 on March 11, 2011, 11:56:38 pm
H:\mywxgl\mywxglMain.h|14|error: #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"|\

thanks for the help I guess this means I have to build wxWidgets my self?



It could mean that or it could mean you did something wrong!!!

Turn on Full Compiler Logging http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Title: Re: wxwidgets and opengl
Post by: LinuxhaxU on March 12, 2011, 12:51:25 am
this is the build log:
Code
Build started on: 11-03-2011 at 16:42.17
Build ended on: 11-03-2011 at 16:42.19
-------------- Build: Debug in recompiled ---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wno-attributes -Wall -g -D__WXDEBUG__ -IH:\wxWidgets2.8\include -IH:\wxWidgets2.8\contrib\include -IH:\wxWidgets2.8\lib\gcc_dll\mswud -c H:\recompiled\recompiledMain.cpp -o obj\Debug\recompiledMain.o
In file included from H:\recompiled\recompiledMain.cpp:10:
H:\recompiled\recompiledMain.h:42: error: ISO C++ forbids declaration of 'wxGLCanvas' with no type
H:\recompiled\recompiledMain.h:42: error: expected ';' before '*' token
H:\recompiled\recompiledMain.cpp: In constructor 'recompiledFrame::recompiledFrame(wxWindow*, wxWindowID)':
H:\recompiled\recompiledMain.cpp:67: error: 'WX_GL_RGBA' was not declared in this scope
H:\recompiled\recompiledMain.cpp:68: error: 'WX_GL_DOUBLEBUFFER' was not declared in this scope
H:\recompiled\recompiledMain.cpp:69: error: 'WX_GL_DEPTH_SIZE' was not declared in this scope
H:\recompiled\recompiledMain.cpp:70: error: 'WX_GL_STENCIL_SIZE' was not declared in this scope
H:\recompiled\recompiledMain.cpp:72: error: 'GLCanvas1' was not declared in this scope
H:\recompiled\recompiledMain.cpp:72: error: expected type-specifier before 'wxGLCanvas'
H:\recompiled\recompiledMain.cpp:72: error: expected ';' before 'wxGLCanvas'
H:\recompiled\recompiledMain.cpp:66: warning: unused variable 'GLCanvasAttributes_1'
Process terminated with status 1 (0 minutes, 2 seconds)
9 errors, 1 warnings
Title: Re: wxwidgets and opengl
Post by: stahta01 on March 12, 2011, 01:49:35 am
If the wxPack wxwidgets was in "H:\wxWidgets2.8" it looks like you have the proper search folder.
These are the two that are needed (by my memory) for wxWidgets Unicode Debug DLL build.
Code
  -IH:\wxWidgets2.8\include 
 -IH:\wxWidgets2.8\lib\gcc_dll\mswud

So, you need to build wxWidgets right and/or change the search path to a location with the proper wxWidgets with GL.

Note: I am not sure that wxPack supplies the debug version of the library; so, you might try doing an non debug build.

Tim S.
Title: Re: wxwidgets and opengl
Post by: LinuxhaxU on March 12, 2011, 03:03:59 am
could you give me some information on building wxwigets or link to something that does?
i followed this website and it didn't seem to do the job...
http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows (http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows)
Title: Re: wxwidgets and opengl
Post by: ollydbg on March 12, 2011, 06:15:02 am
could you give me some information on building wxwigets or link to something that does?
i followed this website and it didn't seem to do the job...
http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows (http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows)

this wiki should be enough. and you can find more information on wxWidgets site.
Title: Re: wxwidgets and opengl
Post by: LinuxhaxU on March 13, 2011, 03:46:45 am
Thanks for all your help I got it up and running after allot of trial and error I did have to rebuild using this site:
http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#Build_and_Run (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#Build_and_Run)
and this one:
http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows (http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows)
thanks for the help!   :D