Page 1 of 1

opengl

Posted: Fri Nov 04, 2011 2:52 pm
by campa
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

Re: opengl

Posted: Fri Nov 04, 2011 7:05 pm
by campa
It works with old wxwidgets 2.8.7

Re: opengl

Posted: Wed Nov 16, 2011 3:08 am
by tbreina
Try doing a webupdate and grabbing the devpaks for gcc and common 2.8.12.2.

Let me know if that fixes it.

-Tony

Re: opengl

Posted: Wed Nov 16, 2011 8:49 am
by campa
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

Re: opengl

Posted: Wed Nov 16, 2011 5:05 pm
by tbreina
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

Re: opengl

Posted: Wed Nov 16, 2011 5:31 pm
by campa
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

Re: opengl

Posted: Wed Nov 16, 2011 5:58 pm
by tbreina
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