Jump to content

  • Log In with Google      Sign In   
  • Create Account


Compiling opengl code using gcc through the command line


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
53 replies to this topic

#21 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:53 PM

I hadn't gotten the new command line when I tried TDM the first time so I was still working with the old one, its the new command line that gave me the new error messages


Edited by 4mad3u5, 22 March 2014 - 10:55 PM.


Sponsor:

#22 Erik Rufelt   Crossbones+   -  Reputation: 3145

Like
1Likes
Like

Posted 23 March 2014 - 05:28 AM

You're getting compile errors. These have nothing to do with libs but with source code, as libs are only ever linked to once compiling succeeds without errors.

Your error "'GLAPI' does not name a type" comes from the fact that the file freeglut_std.h has source-code including 'GLAPI' and the compiler doesn't know what that means.

I would guess that is because you include freeglut_std.h without including gl.h or something like that.

 

The following means that on line 11 in Triangle.cpp you include GL/glut.h, and on line 17 in GL/glut.h that file includes freeglut_std.h, and in that file on line 121 is the error encountered. It's often so that if the first error in a long list like yours is fixed then all others are automatically fixed too.

/freeglut_std.h:121:0,
from /GL/glut.h:17,
from Triangle.cpp:11:

It seems very strange that these headers wouldn't guarantee to have GLAPI already defined.

 

Start by changing your file to include <GL/gl.h> at the top. That is just a guess though but if you're lucky it might change something.

 

If it doesn't work, try to compile this program first (as your current program is already dependent on a lot of different libraries, and it's better to add one at a time):

// Triangle.cpp
// Our first OpenGL program that will just draw a triangle on the screen.

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h> // Windows FreeGlut equivalent

///////////////////////////////////////////////////////////////////////////////
// Window has changed size, or has just been created. In either case, we need
// to use the window dimensions to set the viewport and the projection matrix.
void ChangeSize(int w, int h)
{
    glViewport(0, 0, w, h);
}


///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
    // Clear the window with current blue color
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f );
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Perform the buffer swap to display back buffer
    glutSwapBuffers();
}


///////////////////////////////////////////////////////////////////////////////
// Main entry point for GLUT based programs
int main(int argc, char* argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutInitWindowSize(800, 600);
    glutCreateWindow("Triangle");
    glutReshapeFunc(ChangeSize);
    glutDisplayFunc(RenderScene);

    glutMainLoop();

    return 0;
}

Edited by Erik Rufelt, 23 March 2014 - 05:31 AM.


#23 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 09:19 AM

Hey I think I can get that to work as soon as I get these libraries in my dir, here is what I get when I used your code Erik

 

F:\school\csci\opengl\SB5\Src\Chapter02\Triangle>g++ -IF:\school\csci\opengl\SB5\Src\GLTools\include -IF:\school\csci\opengl\SB5\freegl
ut-2.6.0\include  -Llib -lglew32 -lfreeglut Triangle.cpp
c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglew32
c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lfreeglut
collect2.exe: error: ld returned 1 exit status

Edited by 4mad3u5, 23 March 2014 - 10:43 AM.


#24 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 09:23 AM

I have both libglew32.a and libfreeglut.a in my current working dir so I don't know whats going on



#25 Erik Rufelt   Crossbones+   -  Reputation: 3145

Like
1Likes
Like

Posted 23 March 2014 - 11:37 AM

Seems it doesn't find the library paths. Maybe add -L"path to your directory"..

 

Googling tells me you can add "-Wl,--verbose" to add warnings to the linker..

 

Or try removing -lglew32 and -lfreeglut and just enter libglew32.a on the command line instead. Not sure if that works though..

 

Also, with that code you don't need GLEW so try without that first, then add it after freeglut works, so if something else goes wrong you can be sure which part gives the error.


Edited by Erik Rufelt, 23 March 2014 - 11:39 AM.


#26 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 12:10 PM

I just wanted to see if the commands were case sensitive or not, so I turned all my -l to -L and I got this, which looks like I am not adding header file or some kind of file to my command line

 

C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x3e): undefined reference to `_imp____glutCreateWindowWithExit@8'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x60): undefined reference to `_imp____glutCreateMenuWithExit@8'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x91): undefined reference to `glViewport@16'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0xc4): undefined reference to `glClearColor@16'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0xd3): undefined reference to `glClear@4'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0xdb): undefined reference to `_imp__glutSwapBuffers@0'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x116): undefined reference to `_imp__glutInitDisplayMode@4'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x12f): undefined reference to `_imp__glutInitWindowSize@8'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x14f): undefined reference to `_imp__glutReshapeFunc@4'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x160): undefined reference to `_imp__glutDisplayFunc@4'
C:\Users\Avery\AppData\Local\Temp\ccuFi3W4.o:Triangle.cpp:(.text+0x16a): undefined reference to `_imp__glutMainLoop@0'
collect2.exe: error: ld returned 1 exit status

Edited by 4mad3u5, 23 March 2014 - 12:14 PM.


#27 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 12:24 PM

When I put -Wl,--verbose in the command line I get so much stuff I can't even go to the top it just fills  the command prompt what what I can see is this (sorry this might be a little long):

 

attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libuser32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/user32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1\libuser32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libuser32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/user32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libuser32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/user32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libuser32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/user32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc\libuser32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libuser32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/user32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libuser32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/user32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libuser32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/user32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib\libuser32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libuser32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../user32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libuser32.a succeeded
attempt to open lib/libkernel32.dll.a failed
attempt to open lib/kernel32.dll.a failed
attempt to open lib/libkernel32.a failed
attempt to open lib/kernel32.lib failed
attempt to open lib/libkernel32.dll failed
attempt to open lib/kernel32.dll failed
attempt to open lib\libkernel32.a failed
attempt to open glew32/libkernel32.dll.a failed
attempt to open glew32/kernel32.dll.a failed
attempt to open glew32/libkernel32.a failed
attempt to open glew32/kernel32.lib failed
attempt to open glew32/libkernel32.dll failed
attempt to open glew32/kernel32.dll failed
attempt to open glew32\libkernel32.a failed
attempt to open freeglut/libkernel32.dll.a failed
attempt to open freeglut/kernel32.dll.a failed
attempt to open freeglut/libkernel32.a failed
attempt to open freeglut/kernel32.lib failed
attempt to open freeglut/libkernel32.dll failed
attempt to open freeglut/kernel32.dll failed
attempt to open freeglut\libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libkernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/kernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/kernel32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libkernel32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/kernel32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1\libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libkernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/kernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/kernel32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libkernel32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/kernel32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc\libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libkernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/kernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/kernel32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libkernel32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/kernel32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib\libkernel32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../kernel32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a succeeded
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds01140.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00279.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00529.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00577.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds01215.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds01213.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00236.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds01173.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00510.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00814.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00207.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchds00734.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchdh.o
(c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libkernel32.a)dchdt.o
attempt to open lib/libmingw32.dll.a failed
attempt to open lib/mingw32.dll.a failed
attempt to open lib/libmingw32.a failed
attempt to open lib/mingw32.lib failed
attempt to open lib/libmingw32.dll failed
attempt to open lib/mingw32.dll failed
attempt to open lib\libmingw32.a failed
attempt to open glew32/libmingw32.dll.a failed
attempt to open glew32/mingw32.dll.a failed
attempt to open glew32/libmingw32.a failed
attempt to open glew32/mingw32.lib failed
attempt to open glew32/libmingw32.dll failed
attempt to open glew32/mingw32.dll failed
attempt to open glew32\libmingw32.a failed
attempt to open freeglut/libmingw32.dll.a failed
attempt to open freeglut/mingw32.dll.a failed
attempt to open freeglut/libmingw32.a failed
attempt to open freeglut/mingw32.lib failed
attempt to open freeglut/libmingw32.dll failed
attempt to open freeglut/mingw32.dll failed
attempt to open freeglut\libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/mingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/mingw32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmingw32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/mingw32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1\libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmingw32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc\libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/mingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/mingw32.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingw32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/mingw32.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib\libmingw32.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../mingw32.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a succeeded
attempt to open lib/libgcc.dll.a failed
attempt to open lib/gcc.dll.a failed
attempt to open lib/libgcc.a failed
attempt to open lib/gcc.lib failed
attempt to open lib/libgcc.dll failed
attempt to open lib/gcc.dll failed
attempt to open lib\libgcc.a failed
attempt to open glew32/libgcc.dll.a failed
attempt to open glew32/gcc.dll.a failed
attempt to open glew32/libgcc.a failed
attempt to open glew32/gcc.lib failed
attempt to open glew32/libgcc.dll failed
attempt to open glew32/gcc.dll failed
attempt to open glew32\libgcc.a failed
attempt to open freeglut/libgcc.dll.a failed
attempt to open freeglut/gcc.dll.a failed
attempt to open freeglut/libgcc.a failed
attempt to open freeglut/gcc.lib failed
attempt to open freeglut/libgcc.dll failed
attempt to open freeglut/gcc.dll failed
attempt to open freeglut\libgcc.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libgcc.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/gcc.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libgcc.a succeeded
attempt to open lib/libmoldname.dll.a failed
attempt to open lib/moldname.dll.a failed
attempt to open lib/libmoldname.a failed
attempt to open lib/moldname.lib failed
attempt to open lib/libmoldname.dll failed
attempt to open lib/moldname.dll failed
attempt to open lib\libmoldname.a failed
attempt to open glew32/libmoldname.dll.a failed
attempt to open glew32/moldname.dll.a failed
attempt to open glew32/libmoldname.a failed
attempt to open glew32/moldname.lib failed
attempt to open glew32/libmoldname.dll failed
attempt to open glew32/moldname.dll failed
attempt to open glew32\libmoldname.a failed
attempt to open freeglut/libmoldname.dll.a failed
attempt to open freeglut/moldname.dll.a failed
attempt to open freeglut/libmoldname.a failed
attempt to open freeglut/moldname.lib failed
attempt to open freeglut/libmoldname.dll failed
attempt to open freeglut/moldname.dll failed
attempt to open freeglut\libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmoldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/moldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/moldname.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmoldname.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/moldname.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1\libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmoldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/moldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/moldname.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmoldname.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/moldname.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc\libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmoldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/moldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/moldname.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmoldname.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/moldname.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib\libmoldname.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmoldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../moldname.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmoldname.a succeeded
attempt to open lib/libmingwex.dll.a failed
attempt to open lib/mingwex.dll.a failed
attempt to open lib/libmingwex.a failed
attempt to open lib/mingwex.lib failed
attempt to open lib/libmingwex.dll failed
attempt to open lib/mingwex.dll failed
attempt to open lib\libmingwex.a failed
attempt to open glew32/libmingwex.dll.a failed
attempt to open glew32/mingwex.dll.a failed
attempt to open glew32/libmingwex.a failed
attempt to open glew32/mingwex.lib failed
attempt to open glew32/libmingwex.dll failed
attempt to open glew32/mingwex.dll failed
attempt to open glew32\libmingwex.a failed
attempt to open freeglut/libmingwex.dll.a failed
attempt to open freeglut/mingwex.dll.a failed
attempt to open freeglut/libmingwex.a failed
attempt to open freeglut/mingwex.lib failed
attempt to open freeglut/libmingwex.dll failed
attempt to open freeglut/mingwex.dll failed
attempt to open freeglut\libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/mingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/mingwex.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmingwex.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/mingwex.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1\libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingwex.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmingwex.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingwex.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc\libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/mingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/mingwex.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingwex.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/mingwex.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib\libmingwex.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../mingwex.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmingwex.a succeeded
attempt to open lib/libmsvcrt.dll.a failed
attempt to open lib/msvcrt.dll.a failed
attempt to open lib/libmsvcrt.a failed
attempt to open lib/msvcrt.lib failed
attempt to open lib/libmsvcrt.dll failed
attempt to open lib/msvcrt.dll failed
attempt to open lib\libmsvcrt.a failed
attempt to open glew32/libmsvcrt.dll.a failed
attempt to open glew32/msvcrt.dll.a failed
attempt to open glew32/libmsvcrt.a failed
attempt to open glew32/msvcrt.lib failed
attempt to open glew32/libmsvcrt.dll failed
attempt to open glew32/msvcrt.dll failed
attempt to open glew32\libmsvcrt.a failed
attempt to open freeglut/libmsvcrt.dll.a failed
attempt to open freeglut/msvcrt.dll.a failed
attempt to open freeglut/libmsvcrt.a failed
attempt to open freeglut/msvcrt.lib failed
attempt to open freeglut/libmsvcrt.dll failed
attempt to open freeglut/msvcrt.dll failed
attempt to open freeglut\libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmsvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/msvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/msvcrt.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/libmsvcrt.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/msvcrt.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1\libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmsvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/msvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/msvcrt.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/libmsvcrt.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/msvcrt.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc\libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmsvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/msvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/msvcrt.lib failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmsvcrt.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/msvcrt.dll failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib\libmsvcrt.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmsvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../msvcrt.dll.a failed
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../libmsvcrt.a succeeded
attempt to open c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/crtend.o succeeded
c:/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/crtend.o
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x3e): undefined reference to `_imp____glutCreateWindowWithExit@8'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x60): undefined reference to `_imp____glutCreateMenuWithExit@8'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x91): undefined reference to `glViewport@16'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0xc4): undefined reference to `glClearColor@16'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0xd3): undefined reference to `glClear@4'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0xdb): undefined reference to `_imp__glutSwapBuffers@0'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x116): undefined reference to `_imp__glutInitDisplayMode@4'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x12f): undefined reference to `_imp__glutInitWindowSize@8'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x14f): undefined reference to `_imp__glutReshapeFunc@4'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x160): undefined reference to `_imp__glutDisplayFunc@4'
C:\Users\Avery\AppData\Local\Temp\cccxgYxU.o:Triangle.cpp:(.text+0x16a): undefined reference to `_imp__glutMainLoop@0'
collect2.exe: error: ld returned 1 exit status


#28 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 12:34 PM

I DID IT!!!!!!!!!!!!!!!!!!!!!!

 

command line:

 
g++ -IF:\school\csci\opengl\SB5\Src\GLTools\include -
IF:\school\csci\opengl\SB5\freeglut-2.6.0\include -Llib -Lglew32 -Lfreeglut Triangle.cpp libglut32.a -
lglu32 -lopengl32


#29 Erik Rufelt   Crossbones+   -  Reputation: 3145

Like
1Likes
Like

Posted 23 March 2014 - 12:54 PM

Great, congratulations :)

 

I think the -L with capital L actually adds a folder to search for libraries in so you can probably shorten it a bit by removing those if you don't have folders with those names that need added to the searchpaths.

 

The massive amounts of error messages from --verbose is that the linker tries to be smart when it doesn't find a library and searches all paths it knows and tries to add ".dll.a" and similar to the filenames to see if it can fix an error in the command line.



#30 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 12:56 PM

But I go back to my original triangle and I still get the same error messages. 



#31 Erik Rufelt   Crossbones+   -  Reputation: 3145

Like
1Likes
Like

Posted 23 March 2014 - 01:15 PM

Add one piece of the code at a time.

 

Don't start from the old code, start from the working code and add stuff in.

 

Don't remove the #includes at the top, but add the extra includes under them.



#32 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 01:23 PM

k



#33 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 01:27 PM

It looks these two header files and constant aren't in the working file 
 
#include <GLTools.h> // OpenGL toolkit
#include <GLShaderManager.h> // Shader Manager Class
#define FREEGLUT_STATIC
 
and in the working file there is  #include <GL/gl.h> and #include <GL/glu.h> which aren't in my original file


#34 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 01:44 PM

I think I know what to do with

 #include <GLTools.h> // OpenGL toolkit

#include <GLShaderManager.h> // Shader Manager Class
 
but this constant I think is what is throwing us all off. When I use Visual Studio I have to add this .lib file to my project and I don't know how to handle this using gcc
#define FREEGLUT_STATIC


#35 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 01:51 PM

I have to add two include folders which I have and two library files freeglut_static.lib and gltools.lib and I would think that all I would have to do is switch them out with libfreeglut.a and libglew32.a but maybe I am wrong on libglew32.a



#36 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 02:52 PM

yeah, I have always been able to compile opengl files using Dev C++ that only have 

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h> // Windows FreeGlut equivalent

 

So that actually got me nowhere. I have always been interested in the header files and constant previously stated. 


Edited by 4mad3u5, 23 March 2014 - 02:54 PM.


#37 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 03:25 PM

So the only thing I do is put: #include <GLTools.h> at the top of my file and I start getting all the 

 

c:\tdm-gcc-32\include\gl\glu.h:277:1: error: 'GLAPI' does not name a type
 GLAPI GLint APIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, cons
t GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdoubl
e* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);

 

stuff all over again



#38 Erik Rufelt   Crossbones+   -  Reputation: 3145

Like
1Likes
Like

Posted 23 March 2014 - 03:43 PM

so dont put it at the top, put under the others



#39 Kaptein   Prime Members   -  Reputation: 1947

Like
1Likes
Like

Posted 23 March 2014 - 04:19 PM

It just means the GLTools.h file is poorly constructed, because it doesn't include its own dependencies.

For it to work, you need to include the proper dependencies either in the file, or before including that file, just like Erik said.

 

Also, don't include long hard-coded paths. Just copy the files you need to a "project directory", make the folders you need, and include them with -I and -L

make one directory called libs, and one called include, so you end up with -Iinclude -Llibs

 

That's all there is to it.



#40 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 23 March 2014 - 05:51 PM

Kaptein I am not quite sure what you mean, should I make a folder in my current working dir that is called lib and in that folder there should be an includes folder with all the files I need in it? 






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS