opengl Topic is solved

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
campa
Knows some wx things
Knows some wx things
Posts: 25
Joined: Tue Nov 25, 2008 5:58 pm

opengl

Post by campa » Fri Nov 04, 2011 2:52 pm

Hi,

I have problems with linking my old opengl with new wxDev-c++, I have linked the following library libglu32.a.

[Linker Error] undefined reference to `wxGLCanvas::~wxGLCanvas()'

In previous version it was working.

Regards Andrej

campa
Knows some wx things
Knows some wx things
Posts: 25
Joined: Tue Nov 25, 2008 5:58 pm

Re: opengl

Post by campa » Fri Nov 04, 2011 7:05 pm

It works with old wxwidgets 2.8.7

tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Re: opengl

Post by tbreina » Wed Nov 16, 2011 3:08 am

Try doing a webupdate and grabbing the devpaks for gcc and common 2.8.12.2.

Let me know if that fixes it.

-Tony
Everybody's got something to hide except for me and my monkey.

campa
Knows some wx things
Knows some wx things
Posts: 25
Joined: Tue Nov 25, 2008 5:58 pm

Re: opengl

Post by campa » Wed Nov 16, 2011 8:49 am

I have instaled the library, this is UNICODE build, this is why I have a problem. I have changed the linking of library (added u to all wxwidgets libraries lwx*u), however I still get:

[Linker Error] undefined reference to `wxStringBase::InitWith(char const*, unsigned int, unsigned int)' and os on.

So how can I change the whole program to UNICODE? I am using default gcc compiler 3.4.5. Isnt this gcc ANSI type?

Thank and best regards

Andrej

tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Re: opengl

Post by tbreina » Wed Nov 16, 2011 5:05 pm

campa wrote:I have instaled the library, this is UNICODE build, this is why I have a problem. I have changed the linking of library (added u to all wxwidgets libraries lwx*u), however I still get:

[Linker Error] undefined reference to `wxStringBase::InitWith(char const*, unsigned int, unsigned int)' and os on.

So how can I change the whole program to UNICODE? I am using default gcc compiler 3.4.5. Isnt this gcc ANSI type?

Thank and best regards

Andrej
Go to Project->Project Options->Parameters and in the "Preprocessor Definitions" box add the line:

Code: Select all

_UNICODE
Then do a Rebuild All. That should compile as Unicode and correct the error you are seeing.

I've attached an OpenGL example project for wxDev-C++ 7.4. This works fine on my machine. And no, gcc 3.4.5 can handle ANSI and UNICODE just fine if you add the correct switch.

-Tony
Attachments
wxopengl_tut.7z
OpenGL example for wxDev-C++ 7.4
(5.5 KiB) Downloaded 117 times
Everybody's got something to hide except for me and my monkey.

campa
Knows some wx things
Knows some wx things
Posts: 25
Joined: Tue Nov 25, 2008 5:58 pm

Re: opengl

Post by campa » Wed Nov 16, 2011 5:31 pm

and after changing the linking libraries
from

-l$(WXLIBNAME)
-l$(WXLIBNAME)_gl

to

-l$(WXLIBNAME)u
-l$(WXLIBNAME)u_gl

it started working.

but I still have problems with my project:
68 C:..FEMOS 2D graphFrm.cpp invalid initialization of reference of type 'const wxString&' from expression of type 'const char*'
42 C:\andrej_priv\OSED 1.0.0\OSED graphic\MyGLCanvas.h in passing argument 6 of `MyGLCanvas::MyGLCanvas(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&, int*, const wxPalette&)'

Thx!

Regards Andrej

tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Re: opengl

Post by tbreina » Wed Nov 16, 2011 5:58 pm

campa wrote:and after changing the linking libraries
from

-l$(WXLIBNAME)
-l$(WXLIBNAME)_gl

to

-l$(WXLIBNAME)u
-l$(WXLIBNAME)u_gl

it started working.

but I still have problems with my project:
68 C:..FEMOS 2D graphFrm.cpp invalid initialization of reference of type 'const wxString&' from expression of type 'const char*'
42 C:\andrej_priv\OSED 1.0.0\OSED graphic\MyGLCanvas.h in passing argument 6 of `MyGLCanvas::MyGLCanvas(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&, int*, const wxPalette&)'

Thx!

Regards Andrej

In MyGLCanvas.h, change the MyGLCanvas constructor from:

Code: Select all

const wxString& name="GLCanvas",

to

Code: Select all

const wxString& name=wxT("GLCanvas"),
The wxT() will protect the string for Unicode (and won't hurt ANSI builds either). It's a good idea to wrap all of your constant strings in wxT() or the like.

As far as adding the "u" to the library, you can automatically do this by going to Tools->Compiler Options->wxWidgets and clicking the Unicode checkbox. I think the only library that needs to be manually changed with "u" is the regex.

-Tony
Everybody's got something to hide except for me and my monkey.

Post Reply