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

#1 4mad3u5   Members   -  Reputation: 116

Like
-2Likes
Like

Posted 21 March 2014 - 11:40 PM

Hi, I do not want to use visual studio express because microsoft just wants your cc and they are trying to kill opengl so there is no point to use their compiler. So I want to use Dev C++ gcc from the command line to compile code instead of vs. I have three books that I am using to learn opengl: opengl programming guide, opengl supper bible 5, and interactive computer graphics. I have been able to get code to compile with vs but we are not able to compile using Dev C++ gcc. I have been working with two professors everyday for the last three months and we can't figure this out. 

The first program that I am working with is from SB5. If you want the source code and include folders that I am using you can get them from the supper bible site: www.openglsuperbible.com/previous-editions/ 5th edition I am in chapter 2 triangle. I expect the command line to be something like this: 

g++ -IF:\school\csci\opengl\SB5\Src\GLTools\include -IF:\school\csci\opengl\SB5\freeglut-2.6.0\include Triangle.cpp libglew32.a libfreeglut.a

I have put libglew32.a and libfreeglut.a in my working directory, and I still get a bunch of errors referencing lib files and if I take out the libglew32.a and libfreeglut.a from my command line I get the same error messages so it is for sure not linking to the correct libraries, so I have no idea what to do. Here is the code I am working with: 


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

#include <GLTools.h> // OpenGL toolkit
#include <GLShaderManager.h> // Shader Manager Class

#ifdef __APPLE__
#include <glut/glut.h> // OS X version of GLUT
#else
#define FREEGLUT_STATIC 
#include <GL/glut.h> // Windows FreeGlut equivalent
#endif

GLBatch triangleBatch;
GLShaderManager shaderManager;

///////////////////////////////////////////////////////////////////////////////
// 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);
}


///////////////////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering context. 
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
{
// Blue background
glClearColor(0.0f, 0.0f, 1.0f, 1.0f );

shaderManager.InitializeStockShaders();

// Load up a triangle
GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f, 
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f };

triangleBatch.Begin(GL_TRIANGLES, 3);
triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}



///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f };
shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
triangleBatch.Draw();

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


///////////////////////////////////////////////////////////////////////////////
// Main entry point for GLUT based programs
int main(int argc, char* argv[])
{
gltSetWorkingDirectory(argv[0]);

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(800, 600);
glutCreateWindow("Triangle");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);

GLenum err = glewInit();
if (GLEW_OK != err) {
fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
return 1;
}

SetupRC();

glutMainLoop();
return 0;
}



Here is what happens right after I hit enter on the command line:

In file included from F:/school/csci/opengl/SB5/freeglut-2.6.0/include/GL/freeglut_std.h:121,
from F:/school/csci/opengl/SB5/freeglut-2.6.0/include/GL/glut.h:17,
from Triangle.cpp:11:
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:225: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:225: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:226: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:226: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:227: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:227: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:228: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:228: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:229: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:230: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:231: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:231: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:232: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:232: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:233: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:233: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:234: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:234: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:235: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:235: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:236: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:236: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:237: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:237: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:238: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:238: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:239: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:239: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:240: error: expected constructor, destructor, or type conversion b
efore "const"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:240: error: expected `,' or `;' before "const"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:241: error: expected constructor, destructor, or type conversion b
efore "const"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:241: error: expected `,' or `;' before "const"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:242: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:242: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:243: error: expected constructor, destructor, or type conversion b
efore "const"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:243: error: expected `,' or `;' before "const"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:244: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:244: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:245: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:245: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:246: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:246: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:247: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:248: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:249: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:250: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:250: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:251: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:251: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:252: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:252: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:253: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:253: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:254: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:254: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:255: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:255: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:256: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:256: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:257: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:257: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:258: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:258: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:259: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:260: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:260: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:261: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:261: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:262: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:262: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:263: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:263: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:264: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:264: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:265: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:265: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:266: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:267: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:267: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:268: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:268: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:269: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:269: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:270: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:270: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:271: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:271: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:272: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:272: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:273: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:273: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:274: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:274: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:275: error: expected constructor, destructor, or type conversion b
efore "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:275: error: expected `,' or `;' before "void"
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:276: error: `GLAPI' does not name a type
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/GL/glu.h:277: error: `GLAPI' does not name a type


Edited by 4mad3u5, 22 March 2014 - 12:15 AM.


Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 3904

Like
4Likes
Like

Posted 22 March 2014 - 03:11 AM

There are plenty of good, valid reasons not to use MSVC. What you wrote up there is not among them.

 

That said, Dev-C++ is the most useless replacement you could pick. It's ancient, unmaintained and full of bugs. There are some forks of Dev-C++ which are still actively developed but other tools have several years of headstart on them.

Before using Dev-C++ I would rather use a current gcc without any extra help, just a text editor and the command line. gcc 3.4.2 (which is what you are using) is ten years old. For all intends and purposes it is completely useless to get something done nowadays. Whatever problems you have probably originate in obsolete tools.

 

Investigate Code::Blocks or QtCreator if you want a modern, free IDE. Several other options exist.



#3 4mad3u5   Members   -  Reputation: 116

Like
-3Likes
Like

Posted 22 March 2014 - 03:32 AM

Actually microsoft wanting to kill opengl so there is no point in using their compiler is a pretty good reason. 



#4 4mad3u5   Members   -  Reputation: 116

Like
-3Likes
Like

Posted 22 March 2014 - 03:35 AM

a


Edited by 4mad3u5, 22 March 2014 - 01:11 PM.


#5 Kaptein   Prime Members   -  Reputation: 2061

Like
4Likes
Like

Posted 22 March 2014 - 12:29 PM

Its my instructors that are telling me to use Dev C++ 

 

Just because they are in a position to tell students what the world looks like, doesn't mean it's true. :)

 

For pure C++: Check out TDM-GCC project. It has an up to date GCC. Also mingw64, mingw-builds and so on.

For linux you only need to install g++.

http://tdm-gcc.tdragon.net/

 

You can also check out Qt: http://qt-project.org/

I don't particularly like Qts version of C++, but everything about Qt is easy, well documented, and "it just works." Which is more than you can say for absolutely everything else on particularly Linux.

 

If you are not fond of C++, consider using Python or Java.

You also have some (future) options in game development with HTML5 and all the almost-there stuff that changes every now and then.

 

 

There is also nothing wrong with developing for Microsoft only, considering most people game on windows. Just be aware that programming multiplatform from the beginning really isn't that hard. The longer you go programming with microsofts C++ ABI the longer it will take you to make the correct changes to have your projects work on other systems.

I would consider it an investment in your own future to just stay multiplatform, and also "stay current." (By using the latest versions of absolutely everything)



#6 4mad3u5   Members   -  Reputation: 116

Like
-1Likes
Like

Posted 22 March 2014 - 05:39 PM

thank you very much, nobody wants to help me and all I am getting is people trying to insult me



#7 Erik Rufelt   Crossbones+   -  Reputation: 3387

Like
1Likes
Like

Posted 22 March 2014 - 06:26 PM

Maybe try http://codelite.org/ , I've used it to build OpenGL apps on Linux.

You get errors in included headers, so I would start by building a simpler app in whatever compiler you attempt to use, as in printf("Hello World"); return 0;

Then when that works add one line or function at a time until it doesn't work, and you at least know where it goes wrong.


Edited by Erik Rufelt, 22 March 2014 - 06:26 PM.


#8 Servant of the Lord   Crossbones+   -  Reputation: 18544

Like
2Likes
Like

Posted 22 March 2014 - 06:27 PM

Who insulted you? Could you quote their insult? mellow.png

 

They are helping you. They are telling you:

A) Dev C++ is outdated, buggy, unsupported, and no longer used by the vast majority of programmers.

B) The claims against Microsoft are mostly overstated. And this is a community that is highly geeky and heavily uses Linux as well as Microsoft software.

C) There ARE valid reasons for not wanting to use Microsoft's compiler. OpenGL support isn't one of them. Visual C++ can compile OpenGL just fine.

D) Microsoft's compiler and IDE is generally considered the best that is currently available, though the opensource alternatives are rapidly gaining ground.

E) I personally use GCC myself, and even I avoid the Dev C++ IDE as junk. I now prefer the opensource Qt Creator IDE, which @Kaptein already linked to.

 

When people tell me something I don't want to hear, they are trying to help me. It's sometimes too easy for me to mistake "corrections" for "insults". wink.png


Edited by Servant of the Lord, 22 March 2014 - 06:47 PM.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#9 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 07:42 PM

Servant of the Lord I have posted this question on 4 different sites. 



#10 4mad3u5   Members   -  Reputation: 116

Like
-1Likes
Like

Posted 22 March 2014 - 07:44 PM

I know how to tell the difference between helping and insulting



#11 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 08:26 PM

I installed TDM-GCC and I am getting the same error messages



#12 Kaptein   Prime Members   -  Reputation: 2061

Like
1Likes
Like

Posted 22 March 2014 - 08:57 PM

I installed TDM-GCC and I am getting the same error messages

 

Looking at your code, it seems you are using:

* freeglut

* glew

* the files are 32bit

 

Did you install the 32-bit version of TDM-GCC? If so you should make sure you have an up-to-date version of glew32 and freeglut32:

 

Windows binaries for freeglut:

http://files.transmissionzero.co.uk/software/development/GLUT/freeglut-MinGW.zip

Windows binaries for glew:

https://sourceforge.net/projects/glew/files/glew/1.10.0/glew-1.10.0-win32.zip/download

 

Make a 'lib' folder and 'include' folder. Copy the headers into /include and the libs into /lib

 

Copy all the header files from this hard-coded path also into ./include

F:\school\csci\opengl\SB5\Src\GLTools\include

 

Compile with:

g++ -Iinclude -Llib -lglew32 -lfreeglut Triangle.cpp

 

It's just a guess for what the compile line would look like. You are basically telling the compiler that all the .h files are in ./include and all the .a files are in ./lib.

You are also "utilizing" the glew32 and freeglut libraries, which are the libglew32.a and libfreeglut.a files respectively.

 

As a sidenote: I'm not sure why your teachers have not just set up a proper makefile with a working directory structure.

It's possible to create a project setup that compiles on both windows and (at least) Ubuntu-derived Linux as well as OS X without having to do anything but "make."

All you need is to create win32 linux osx folders inside "lib" folder and create a slightly more complicated makefile manually.

It's not the best solution, but it will work for the students.

For example you might not want to add the linux libs, since you typically install these libs with package managers, or manually with "make install." It would cover 32 and 64bit.

 

Better than hard-coding in network paths at least.

 

Oh and, is GLTools a library? If it is, then you need to compile it into a library, as well as include its headers.


Edited by Kaptein, 22 March 2014 - 09:05 PM.


#13 4mad3u5   Members   -  Reputation: 116

Like
-1Likes
Like

Posted 22 March 2014 - 08:59 PM

k, thanks. I was currently checking to see if I was using the 32 bit versions of libfreeglut.a and libglew.a



#14 Kaptein   Prime Members   -  Reputation: 2061

Like
1Likes
Like

Posted 22 March 2014 - 09:08 PM

k, thanks. I was currently checking to see if I was using the 32 bit versions of libfreeglut.a and libglew.a

 

Btw. did you add C:\TDM-GCC\bin to the PATH enviroment variable?

Because you need to execute g++ from the directory that contains Triangle.cpp

 

Come to think of it:

It looks like you are still using Dev-C++, which uses an old gcc. Probably. Uninstall it, and make sure it's removed from PATH.

Because you would not get the same error messages on windows, if you installed TDM-GCC. I think the installer adds C:\TDM-GCC\bin to PATH during the installation.

 

Also, make sure TDM-GCC is the same system type as the libraries you are trying to use with it. If g++ --version is 64-bit, you'll want the 64-bit libraries and vice versa.


Edited by Kaptein, 22 March 2014 - 09:14 PM.


#15 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:28 PM

no I uninstalled Dev C++  



#16 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:30 PM

It is going to take me some time to make sure that I am doing everything you told me to do



#17 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:31 PM

I installed the 32 bit version of TDM



#18 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:33 PM

I set my new path to the bin dir SET PATH=%PATH%;C:\TDM-GCC-32\bin if that is the set path that you are talking about



#19 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:39 PM

I need to see if I did everything you said but when I put into the command line:

 

this is the command line you told me to do

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
 
and just for the heck of it I did mine
g++ -IF:\school\csci\opengl\SB5\Src\GLTools\include -IF:\school\csci\opengl\SB5\freegl
ut-2.6.0\include Triangle.cpp libglew32.a libfreeglut.a
 
I got a new error message saying this both times: 
 
In file included from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/freeglut_std.h:121:0,
                 from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/glut.h:17,
                 from Triangle.cpp:11:
c:\tdm-gcc-32\include\gl\glu.h:225:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluBeginCurve (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:226:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluBeginPolygon (GLUtesselator* tess);
 ^
c:\tdm-gcc-32\include\gl\glu.h:227:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluBeginSurface (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:228:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluBeginTrim (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:229:1: error: 'GLAPI' does not name a type
 GLAPI GLint APIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const vo
ta);
 ^
In file included from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/freeglut_std.h:121:0,
                 from F:\school\csci\opengl\SB5\freeglut-2.6.0\include/GL/glut.h:17,
                 from Triangle.cpp:11:
c:\tdm-gcc-32\include\gl\glu.h:230:1: error: 'GLAPI' does not name a type
 GLAPI GLint APIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenu
, const void *data);
 ^
c:\tdm-gcc-32\include\gl\glu.h:231:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
 ^
c:\tdm-gcc-32\include\gl\glu.h:232:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:233:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluDeleteQuadric (GLUquadric* quad);
 ^
c:\tdm-gcc-32\include\gl\glu.h:234:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluDeleteTess (GLUtesselator* tess);
 ^
c:\tdm-gcc-32\include\gl\glu.h:235:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
 ^
c:\tdm-gcc-32\include\gl\glu.h:236:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluEndCurve (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:237:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluEndPolygon (GLUtesselator* tess);
 ^
c:\tdm-gcc-32\include\gl\glu.h:238:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluEndSurface (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:239:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluEndTrim (GLUnurbs* nurb);
 ^
c:\tdm-gcc-32\include\gl\glu.h:240:1: error: 'GLAPI' does not name a type
 GLAPI const GLubyte * APIENTRY gluErrorString (GLenum error);
 ^
c:\tdm-gcc-32\include\gl\glu.h:241:1: error: 'GLAPI' does not name a type
 GLAPI const wchar_t * APIENTRY gluErrorUnicodeStringEXT (GLenum error);
 ^
c:\tdm-gcc-32\include\gl\glu.h:242:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
 ^
c:\tdm-gcc-32\include\gl\glu.h:243:1: error: 'GLAPI' does not name a type
 GLAPI const GLubyte * APIENTRY gluGetString (GLenum name);
 ^
c:\tdm-gcc-32\include\gl\glu.h:244:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
 ^
c:\tdm-gcc-32\include\gl\glu.h:245:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view
 ^
c:\tdm-gcc-32\include\gl\glu.h:246:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ
uble upX, GLdouble upY, GLdouble upZ);
 ^
c:\tdm-gcc-32\include\gl\glu.h:247:1: error: 'GLAPI' does not name a type
 GLAPI GLUnurbs* APIENTRY gluNewNurbsRenderer (void);
 ^
c:\tdm-gcc-32\include\gl\glu.h:248:1: error: 'GLAPI' does not name a type
 GLAPI GLUquadric* APIENTRY gluNewQuadric (void);
 ^
c:\tdm-gcc-32\include\gl\glu.h:249:1: error: 'GLAPI' does not name a type
 GLAPI GLUtesselator* APIENTRY gluNewTess (void);
 ^
c:\tdm-gcc-32\include\gl\glu.h:250:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
 ^
c:\tdm-gcc-32\include\gl\glu.h:251:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
 ^
c:\tdm-gcc-32\include\gl\glu.h:252:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order,
m type);
 ^
c:\tdm-gcc-32\include\gl\glu.h:253:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
 ^
c:\tdm-gcc-32\include\gl\glu.h:254:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint
de, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
 ^
c:\tdm-gcc-32\include\gl\glu.h:255:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
 ^
c:\tdm-gcc-32\include\gl\glu.h:256:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start,
ble sweep);
 ^
c:\tdm-gcc-32\include\gl\glu.h:257:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
 ^
c:\tdm-gcc-32\include\gl\glu.h:258:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
 ^
c:\tdm-gcc-32\include\gl\glu.h:259:1: error: 'GLAPI' does not name a type
 GLAPI GLint APIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const
 *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
 ^
c:\tdm-gcc-32\include\gl\glu.h:260:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
 ^
c:\tdm-gcc-32\include\gl\glu.h:261:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
 ^
c:\tdm-gcc-32\include\gl\glu.h:262:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
 ^
c:\tdm-gcc-32\include\gl\glu.h:263:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
 ^
c:\tdm-gcc-32\include\gl\glu.h:264:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
 ^
c:\tdm-gcc-32\include\gl\glu.h:265:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
 ^
c:\tdm-gcc-32\include\gl\glu.h:266:1: error: 'GLAPI' does not name a type
 GLAPI GLint APIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GL
hOut, GLenum typeOut, GLvoid* dataOut);
 ^
c:\tdm-gcc-32\include\gl\glu.h:267:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
 ^
c:\tdm-gcc-32\include\gl\glu.h:268:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessBeginContour (GLUtesselator* tess);
 ^
c:\tdm-gcc-32\include\gl\glu.h:269:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
 ^
c:\tdm-gcc-32\include\gl\glu.h:270:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
 ^
c:\tdm-gcc-32\include\gl\glu.h:271:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessEndContour (GLUtesselator* tess);
 ^
c:\tdm-gcc-32\include\gl\glu.h:272:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessEndPolygon (GLUtesselator* tess);
 ^
c:\tdm-gcc-32\include\gl\glu.h:273:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
 ^
c:\tdm-gcc-32\include\gl\glu.h:274:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
 ^
c:\tdm-gcc-32\include\gl\glu.h:275:1: error: 'GLAPI' does not name a type
 GLAPI void APIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
 ^
c:\tdm-gcc-32\include\gl\glu.h:276:1: error: 'GLAPI' does not name a type
 GLAPI GLint APIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, con
nt *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
 ^
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, const GLdouble *model, const GL
 *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);

Edited by 4mad3u5, 22 March 2014 - 11:43 PM.


#20 4mad3u5   Members   -  Reputation: 116

Like
0Likes
Like

Posted 22 March 2014 - 10:44 PM

I set my path to the bin dir and then go to my working dir






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