Author Topic: wxwidgets and opengl  (Read 9884 times)

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
wxwidgets and opengl
« 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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxwidgets and opengl
« Reply #1 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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: wxwidgets and opengl
« Reply #2 on: March 11, 2011, 02:17:02 am »
thanks for the quick response I used wxPack http://wxpack.sourceforge.net/Main/Downloads   
the latest.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxwidgets and opengl
« Reply #3 on: March 11, 2011, 04:19:43 am »
thanks for the quick response I used wxPack 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.
« Last Edit: March 11, 2011, 04:28:47 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: wxwidgets and opengl
« Reply #4 on: March 11, 2011, 05:12:28 am »
the specified library? so wxpack does have it enable and Im not linking correctly?
« Last Edit: March 11, 2011, 05:14:05 am by LinuxhaxU »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: wxwidgets and opengl
« Reply #5 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.
« Last Edit: March 11, 2011, 04:11:04 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: wxwidgets and opengl
« Reply #6 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?


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: wxwidgets and opengl
« Reply #7 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
« Last Edit: March 12, 2011, 12:48:11 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: wxwidgets and opengl
« Reply #8 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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: wxwidgets and opengl
« Reply #9 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: wxwidgets and opengl
« Reply #10 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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxwidgets and opengl
« Reply #11 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

this wiki should be enough. and you can find more information on wxWidgets site.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline LinuxhaxU

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: wxwidgets and opengl
« Reply #12 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
and this one:
http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.9_Monolithic_Build_with_openGL_for_Windows
thanks for the help!   :D