wxGLCanvas compiling problem in simple example

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

wxGLCanvas compiling problem in simple example

Post by Daniel_Cro »

Hello,

I have recently tried simple openGL example, but failed.
I have followed instructions:
- edited include/wx/msw/setup.h with wxUSE_GLCANVAS=1
- added USE_OPENGL=1 to command line in CodeLite project preferences under compiling (but I am not sure if this is correct)
- opengl32.lib I did NOT add !!!

I am a newbie in GUI programming and don't understand quite a lot...
To me it seems that wxWidgets does not come complete for openGL... I have downloaded glut for win32 therefore and corrected include statements in my source... no help.

When I get home, I can post the compiling errors, but I was hoping that someone probably knows what is wrong...
Basically, I have downloaded CodeLite with wxWidgets and it all works "from the box" for the "non openGL" programs. What else is needed to make simple "penguin" example work??

Thank you in advance!
Daniel
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Hi,

we definitely need the exact error messages.
"Keyboard not detected. Press F1 to continue"
-- Windows
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

Post by Daniel_Cro »

Thank you for your time!!

Here are the compiling messages:

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "openGLproject_wsp.mk""
----------Building project:[ openGLproject - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Program Files (x86)/CodeLite/projects/openGLproject'
g++ -c  "C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.8.10\lib\gcc_dll\mswud -IC:\wxWidgets-2.8.10\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0    -D__WX__  -o ./Debug/main.o "-I." 
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:17: error: expected class-name before '{' token
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:26: error: 'wxGLCanvas' has not been declared
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:27: error: invalid static_cast from type 'void (wxGLCanvasSubClass::*)(wxPaintEvent&)' to type 'void (wxEvtHandler::*)(wxPaintEvent&)'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp: In constructor 'wxGLCanvasSubClass::wxGLCanvasSubClass(wxFrame*)':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:31: error: class 'wxGLCanvasSubClass' does not have any field named 'wxGLCanvas'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp: In member function 'void wxGLCanvasSubClass::Render()':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:51: error: 'SetCurrent' was not declared in this scope
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:52: error: no matching function for call to 'wxPaintDC::wxPaintDC(wxGLCanvasSubClass* const)'
C:\wxWidgets-2.8.10\include/wx/msw/dcclient.h:96: note: candidates are: wxPaintDC::wxPaintDC(const wxPaintDC&)
C:\wxWidgets-2.8.10\include/wx/msw/dcclient.h:82: note:                 wxPaintDC::wxPaintDC(wxWindow*)
C:\wxWidgets-2.8.10\include/wx/msw/dcclient.h:79: note:                 wxPaintDC::wxPaintDC()
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:55: error: 'GetSize' was not declared in this scope
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/wingdi.h:3032: error: too few arguments to function 'BOOL SwapBuffers(HDC__*)'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:85: error: at this point in file
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp: At global scope:
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:91: error: ISO C++ forbids declaration of 'wxGLCanvas' with no type
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:91: error: expected ';' before '*' token
mingw32-make.exe[1]: *** [Debug/main.o] Error 1
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `C:/Program Files (x86)/CodeLite/projects/openGLproject'
----------Build Ended----------
1 errors, 3 warnings
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

These errors simply look like you forgot

Code: Select all

#include <wx/glcanvas.h>
Now, if that's not the problem, please post the source code, if possible with annotations so we can easily see at which lines the errors are being reported
"Keyboard not detected. Press F1 to continue"
-- Windows
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

Post by Daniel_Cro »

it is first example from WxWiki...

Code: Select all

// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability.
 
#include <wx/wx.h>
#include <wx/glcanvas.h>
 
#ifdef __WXMAC__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
 
#ifndef WIN32
#include <unistd.h> // FIXME: ¿This work/necessary in Windows?
                    //Not necessary, but if it was, it needs to be replaced by process.h AND io.h
#endif
 
class wxGLCanvasSubClass: public wxGLCanvas {
        void Render();
public:
    wxGLCanvasSubClass(wxFrame* parent);
    void Paintit(wxPaintEvent& event);
protected:
    DECLARE_EVENT_TABLE()
};
 
BEGIN_EVENT_TABLE(wxGLCanvasSubClass, wxGLCanvas)
    EVT_PAINT    (wxGLCanvasSubClass::Paintit)
END_EVENT_TABLE()
 
wxGLCanvasSubClass::wxGLCanvasSubClass(wxFrame *parent)
:wxGLCanvas(parent, wxID_ANY,  wxDefaultPosition, wxDefaultSize, 0, wxT("GLCanvas")){
    int argc = 1;
    char* argv[1] = { wxString((wxTheApp->argv)[0]).char_str() };
 
/*
NOTE: this example uses GLUT in order to have a free teapot model
to display, to show 3D capabilities. GLUT, however, seems to cause problems
on some systems. If you meet problems, first try commenting out glutInit(),
then try comeenting out all glut code
*/
    glutInit(&argc, argv);
}
 
 
void wxGLCanvasSubClass::Paintit(wxPaintEvent& WXUNUSED(event)){
    Render();
}
 
void wxGLCanvasSubClass::Render()
{
    SetCurrent();
    wxPaintDC(this);
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glViewport(0, 0, (GLint)GetSize().x, (GLint)GetSize().y);
 
    glBegin(GL_POLYGON);
        glColor3f(1.0, 1.0, 1.0);
        glVertex2f(-0.5, -0.5);
        glVertex2f(-0.5, 0.5);
        glVertex2f(0.5, 0.5);
        glVertex2f(0.5, -0.5);
        glColor3f(0.4, 0.5, 0.4);
        glVertex2f(0.0, -0.8);
    glEnd();
 
    glBegin(GL_POLYGON);
        glColor3f(1.0, 0.0, 0.0);
        glVertex2f(0.1, 0.1);
        glVertex2f(-0.1, 0.1);
        glVertex2f(-0.1, -0.1);
        glVertex2f(0.1, -0.1);
    glEnd();
 
// using a little of glut
    glColor4f(0,0,1,1);
    glutWireTeapot(0.4);
 
    glLoadIdentity();
    glColor4f(2,0,1,1);
    glutWireTeapot(0.6);
// done using glut
 
    glFlush();
    SwapBuffers();
}
 
class MyApp: public wxApp
{
    virtual bool OnInit();
    wxGLCanvas * MyGLCanvas;
};
 
 
IMPLEMENT_APP(MyApp)
 
  
bool MyApp::OnInit()
{
    wxFrame *frame = new wxFrame((wxFrame *)NULL, -1,  wxT("Hello GL World"), wxPoint(50,50), wxSize(200,200));
    new wxGLCanvasSubClass(frame);
 
    frame->Show(TRUE);
    return TRUE;
}
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

OK.

You say :
- edited include/wx/msw/setup.h with wxUSE_GLCANVAS=1
- added USE_OPENGL=1 to command line in CodeLite project preferences under compiling (but I am not sure if this is correct)
but did you rebuild wxWidgets after changing that? You will need to build wxWidgets after enabling OpenGL support
"Keyboard not detected. Press F1 to continue"
-- Windows
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

Post by Daniel_Cro »

uuuuu
this is new information... no I did not recompile it...
Thank you for the info! I will try that!
One question, however... Since I downloaded CodeLite with wxwidgets and it all worked out of the box... I am afraid that recompiling could damage what is already working...?

I will inform you on my progress...

Thank you again!
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Well, setting up wxWidgets manually is a tiny bit more complicated than using a pre-compiled binary, that's right. But CodeLite comes with its own DLLs so you can't mess up CodeLite itself. You will need to reconfigure your project however.

Maybe you can ask the CodeLite author if he could provide builds with OpenGL included ;)
Or maybe you can use the binaries from wxPack. Or wx 2.9, since 2.9.x includes OpenGL by default
"Keyboard not detected. Press F1 to continue"
-- Windows
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

Post by Daniel_Cro »

I have successfully recompiled wxWidgets with setup.h modified (hope it was the right one since more of them existed there; C:\wxWidgets-2.8.11\include\wx\msw\setup.h) and with command added USE_OPENGL=1 (and with RELEASE=debug instead of release)

Afterwards in CodeLite I have changed build environment form version 2.8.10 to 2.8.11 (one I recompiled) and run it...

It obviously complained about missing GL/glut.h which does not exist...
So I have downloaded precompiled GLUT libraries for Windows...
This time error compiling error was:

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "openGLproject_wsp.mk""
----------Building project:[ openGLproject - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Program Files (x86)/CodeLite/projects/openGLproject'
g++ -c  "C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.8.11\lib\gcc_dll\mswud -IC:\wxWidgets-2.8.11\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0    -D__WX__  -o ./Debug/main.o "-I." 
g++ -o ./Debug/openGLproject ./Debug/main.o  "-L."   -mwindows  -mthreads -LC:\wxWidgets-2.8.11\lib\gcc_dll -lwxmsw28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
./Debug/main.o: In function `glutInit_ATEXIT_HACK':
C:/wxWidgets-2.8.11/include/GL/glut.h:486: undefined reference to `__glutInitWithExit@12'
./Debug/main.o: In function `glutCreateWindow_ATEXIT_HACK':
C:/wxWidgets-2.8.11/include/GL/glut.h:503: undefined reference to `__glutCreateWindowWithExit@8'
./Debug/main.o: In function `glutCreateMenu_ATEXIT_HACK':
C:/wxWidgets-2.8.11/include/GL/glut.h:549: undefined reference to `__glutCreateMenuWithExit@8'
./Debug/main.o: In function `wxGLCanvasSubClass':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:31: undefined reference to `_imp___ZN10wxGLCanvasC2EP8wxWindowiRK7wxPointRK6wxSizelRK8wxStringPiRK9wxPalette'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:42: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:31: undefined reference to `_imp___ZN10wxGLCanvasC2EP8wxWindowiRK7wxPointRK6wxSizelRK8wxStringPiRK9wxPalette'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:42: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:51: undefined reference to `_imp___ZN10wxGLCanvas10SetCurrentEv'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:53: undefined reference to `glClearColor@16'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:54: undefined reference to `glClear@4'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:55: undefined reference to `glViewport@16'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:57: undefined reference to `glBegin@4'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:58: undefined reference to `glColor3f@12'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:59: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:60: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:61: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:62: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:63: undefined reference to `glColor3f@12'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:64: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:65: undefined reference to `glEnd@0'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:67: undefined reference to `glBegin@4'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:68: undefined reference to `glColor3f@12'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:69: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:70: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:71: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:72: undefined reference to `glVertex2f@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:73: undefined reference to `glEnd@0'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:76: undefined reference to `glColor4f@16'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:77: undefined reference to `glutWireTeapot@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:79: undefined reference to `glLoadIdentity@0'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:80: undefined reference to `glColor4f@16'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:81: undefined reference to `glutWireTeapot@8'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:84: undefined reference to `glFlush@0'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:85: undefined reference to `_imp___ZN10wxGLCanvas11SwapBuffersEv'
./Debug/main.o: In function `_static_initialization_and_destruction_0':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:26: undefined reference to `_imp___ZN10wxGLCanvas13sm_eventTableE'
./Debug/main.o:main.cpp:(.rdata$_ZTV18wxGLCanvasSubClass[vtable for wxGLCanvasSubClass]+0x8): undefined reference to `wxGLCanvas::GetClassInfo() const'
./Debug/main.o: In function `~wxGLCanvasSubClass':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:17: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:17: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/openGLproject] Error 1
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `C:/Program Files (x86)/CodeLite/projects/openGLproject'
----------Build Ended----------
0 errors, 0 warnings
which (alongside the date in accompanying txt file that states year 2001) should mean that I have outdated version? Or build with different compiler?

Is my solution to download new version of GLUT and recompile it my computer???
Or, would it be more easier to use version 2.9 of wxWidgets???
Isn't that unstable release by the way?

Thank you for your help... I think we are making progress!
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

You need to link against the OpenGL DLL (and also the GLUT one, if you wish to use GLUT, but you could just remove the glut parts too)
"Keyboard not detected. Press F1 to continue"
-- Windows
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif »

FYI:
The wxWidgets that comes with codelite is not compiled with OpenGL

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

Post by Daniel_Cro »

Hello!

- I have downloaded wxWidgets version 2.9.0
- then I have changed all setup.h which contained line wxUSE_GLCANVAS to "1"
- then I successfully recompiled with mingw but with options USE_OPENGL=1 and with BUILD=debug
- compiling penguin, cube and previous examples resulted in error messages like this (glut related lines were removed where they caused problems):

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "cube_wsp.mk""
----------Building project:[ cube - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Program Files (x86)/CodeLite/projects/cube'
g++ -c  "C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.9.0\lib\gcc_dll\mswud -IC:\wxWidgets-2.9.0\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0    -D__WX__  -o ./Debug/cube.o "-I." 
g++ -o ./Debug/cube ./Debug/cube.o  "-L."   -mwindows  -mthreads -LC:\wxWidgets-2.9.0\lib\gcc_dll -lwxmsw29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
./Debug/cube.o: In function `CheckGLError':
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:51: undefined reference to `glGetError@0'
./Debug/cube.o: In function `TestGLContext':
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:126: undefined reference to `_imp___ZN11wxGLContextC2EP10wxGLCanvasPKS_'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:128: undefined reference to `_imp___ZNK11wxGLContext10SetCurrentERK10wxGLCanvas'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:131: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:132: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:133: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:134: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:138: undefined reference to `glLightfv@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:141: undefined reference to `glMatrixMode@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:142: undefined reference to `glLoadIdentity@0'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:143: undefined reference to `glFrustum@48'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:149: undefined reference to `glGenTextures@8'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:153: undefined reference to `glBindTexture@8'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:155: undefined reference to `glTexEnvf@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:156: undefined reference to `glTexParameterf@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:157: undefined reference to `glTexParameterf@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:158: undefined reference to `glTexParameteri@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:159: undefined reference to `glTexParameteri@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:163: undefined reference to `glPixelStorei@8'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:165: undefined reference to `glTexImage2D@36'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:169: undefined reference to `_imp___ZN11wxGLContextD2Ev'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:126: undefined reference to `_imp___ZN11wxGLContextC2EP10wxGLCanvasPKS_'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:128: undefined reference to `_imp___ZNK11wxGLContext10SetCurrentERK10wxGLCanvas'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:131: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:132: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:133: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:134: undefined reference to `glEnable@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:138: undefined reference to `glLightfv@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:141: undefined reference to `glMatrixMode@4'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:142: undefined reference to `glLoadIdentity@0'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:143: undefined reference to `glFrustum@48'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:149: undefined reference to `glGenTextures@8'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:153: undefined reference to `glBindTexture@8'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:155: undefined reference to `glTexEnvf@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:156: undefined reference to `glTexParameterf@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:157: undefined reference to `glTexParameterf@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:158: undefined reference to `glTexParameteri@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:159: undefined reference to `glTexParameteri@12'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:163: undefined reference to `glPixelStorei@8'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:165: undefined reference to `glTexImage2D@36'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:169: undefined reference to `_imp___ZN11wxGLContextD2Ev'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:173: undefined reference to `glClear@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:175: undefined reference to `glMatrixMode@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:176: undefined reference to `glLoadIdentity@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:177: undefined reference to `glTranslatef@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:178: undefined reference to `glRotatef@16'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:179: undefined reference to `glRotatef@16'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:182: undefined reference to `glBindTexture@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:183: undefined reference to `glBegin@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:184: undefined reference to `glNormal3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:185: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:185: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:186: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:186: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:187: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:187: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:188: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:188: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:189: undefined reference to `glEnd@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:191: undefined reference to `glBindTexture@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:192: undefined reference to `glBegin@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:193: undefined reference to `glNormal3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:194: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:194: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:195: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:195: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:196: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:196: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:197: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:197: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:198: undefined reference to `glEnd@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:200: undefined reference to `glBindTexture@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:201: undefined reference to `glBegin@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:202: undefined reference to `glNormal3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:203: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:203: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:204: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:204: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:205: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:205: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:206: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:206: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:207: undefined reference to `glEnd@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:209: undefined reference to `glBindTexture@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:210: undefined reference to `glBegin@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:211: undefined reference to `glNormal3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:212: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:212: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:213: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:213: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:214: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:214: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:215: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:215: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:216: undefined reference to `glEnd@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:218: undefined reference to `glBindTexture@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:219: undefined reference to `glBegin@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:220: undefined reference to `glNormal3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:221: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:221: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:222: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:222: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:223: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:223: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:224: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:224: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:225: undefined reference to `glEnd@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:227: undefined reference to `glBindTexture@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:228: undefined reference to `glBegin@4'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:229: undefined reference to `glNormal3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:230: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:230: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:231: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:231: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:232: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:232: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:233: undefined reference to `glTexCoord2f@8'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:233: undefined reference to `glVertex3f@12'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:234: undefined reference to `glEnd@0'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:236: undefined reference to `glFlush@0'
./Debug/cube.o: In function `TestGLCanvas':
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:295: undefined reference to `_imp___ZN10wxGLCanvasC2EP8wxWindowiPKiRK7wxPointRK6wxSizelRK8wxStringRK9wxPalette'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:295: undefined reference to `_imp___ZN10wxGLCanvasC2EP8wxWindowiPKiRK7wxPointRK6wxSizelRK8wxStringRK9wxPalette'
./Debug/cube.o:C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:314: undefined reference to `glViewport@16'
./Debug/cube.o: In function `MyFrame':
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:396: undefined reference to `_imp___ZN14wxGLCanvasBase18IsDisplaySupportedEPKi'
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:396: undefined reference to `_imp___ZN14wxGLCanvasBase18IsDisplaySupportedEPKi'
./Debug/cube.o: In function `_static_initialization_and_destruction_0':
C:/Program Files (x86)/CodeLite/projects/cube/cube.cpp:283: undefined reference to `_imp___ZN10wxGLCanvas13sm_eventTableE'
./Debug/cube.o: In function `~TestGLContext':
C:/Program Files (x86)/CodeLite/projects/cube/cube.h:19: undefined reference to `_imp___ZN11wxGLContextD2Ev'
C:/Program Files (x86)/CodeLite/projects/cube/cube.h:19: undefined reference to `_imp___ZN11wxGLContextD2Ev'
./Debug/cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[vtable for TestGLCanvas]+0x8): undefined reference to `wxGLCanvas::GetClassInfo() const'
./Debug/cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[vtable for TestGLCanvas]+0x320): undefined reference to `wxGLCanvas::SwapBuffers()'
./Debug/cube.o:cube.cpp:(.rdata$_ZTV12TestGLCanvas[vtable for TestGLCanvas]+0x328): undefined reference to `wxGLCanvas::CreateDefaultPalette()'
./Debug/cube.o:cube.cpp:(.rdata$_ZTV13TestGLContext[vtable for TestGLContext]+0x8): undefined reference to `wxGLContext::GetClassInfo() const'
./Debug/cube.o:cube.cpp:(.rdata$_ZTV13TestGLContext[vtable for TestGLContext]+0x1c): undefined reference to `wxGLContext::SetCurrent(wxGLCanvas const&) const'
./Debug/cube.o: In function `~TestGLCanvas':
C:/Program Files (x86)/CodeLite/projects/cube/cube.h:64: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
C:/Program Files (x86)/CodeLite/projects/cube/cube.h:64: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/cube] Error 1
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `C:/Program Files (x86)/CodeLite/projects/cube'
----------Build Ended----------
0 errors, 0 warnings
I will try now with "release" instead of "debug" since this is only thing that I modified...
C:\wxWidgets-2.9.0\build\msw>mingw32-make -f makefile.gcc USE_OPENGL=1 MONOLITHIC=1 SHARED=1 UNICODE
=1 BUILD=release
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

You need to link against the OpenGL DLL. GO in your build settings and add the OpenGL DLL in the librairies over there
"Keyboard not detected. Press F1 to continue"
-- Windows
Daniel_Cro
Earned a small fee
Earned a small fee
Posts: 11
Joined: Tue Aug 31, 2010 9:02 am
Location: Croatia, Europe
Contact:

Post by Daniel_Cro »

Hm...
No luck here... from what I found on Internet I should be linking against libopengl32.a (MinGW opengl library) since openGL.lib (not DLL) is from (for) Visual Studio...
errors:

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "openGLproject_wsp.mk""
----------Building project:[ openGLproject - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Program Files (x86)/CodeLite/projects/openGLproject'
g++ -c  "C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.8.11\lib\gcc_dll\mswud -IC:\wxWidgets-2.8.11\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0    -D__WX__  -o ./Debug/main.o "-I." 
g++ -o ./Debug/openGLproject ./Debug/main.o  "-L."  -lopengl32  -mwindows  -mthreads -LC:\wxWidgets-2.8.11\lib\gcc_dll -lwxmsw28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
./Debug/main.o: In function `wxGLCanvasSubClass':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:25: undefined reference to `_imp___ZN10wxGLCanvasC2EP8wxWindowiRK7wxPointRK6wxSizelRK8wxStringPiRK9wxPalette'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:36: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:25: undefined reference to `_imp___ZN10wxGLCanvasC2EP8wxWindowiRK7wxPointRK6wxSizelRK8wxStringPiRK9wxPalette'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:36: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:45: undefined reference to `_imp___ZN10wxGLCanvas10SetCurrentEv'
./Debug/main.o:C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:79: undefined reference to `_imp___ZN10wxGLCanvas11SwapBuffersEv'
./Debug/main.o: In function `_static_initialization_and_destruction_0':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:20: undefined reference to `_imp___ZN10wxGLCanvas13sm_eventTableE'
./Debug/main.o:main.cpp:(.rdata$_ZTV18wxGLCanvasSubClass[vtable for wxGLCanvasSubClass]+0x8): undefined reference to `wxGLCanvas::GetClassInfo() const'
./Debug/main.o: In function `~wxGLCanvasSubClass':
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:11: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
C:/Program Files (x86)/CodeLite/projects/openGLproject/main.cpp:11: undefined reference to `_imp___ZN10wxGLCanvasD2Ev'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/openGLproject] Error 1
mingw32-make.exe[1]: Leaving directory `C:/Program Files (x86)/CodeLite/projects/openGLproject'
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
0 errors, 0 warnings
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

in MinGW there is a tool called dlltool and something sounds like like reimp. With the latter you generate .def from dll and using that def file and dll you invoke dlltool to get .a file. I will post example for you later
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply