PDA

View Full Version : using gcc with opengl



Amad3u5
03-20-2014, 11:17 PM
Hi, I am a computer science and electrical engineering student trying to learn opengl on the side with my teacher. We 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 we 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.

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/ (http://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;
}


The second program I am working with is from OpenGl programming Guide 8th edition you can get the source code and include folders from here: www.opengl-redbook.com/ (http://www.opengl-redbook.com/) and I expect the command line to be something like this:

g++ -I..\include triangle.cpp LoadShaders.cpp libglew32.a libfreeglut.a -lopengl21 -lglu32 -lgdi32 -luser32 -lwinm


and that code that I am working with is this:


///////////////////////////////////////////////////////////////////////
//
// triangles.cpp
//
///////////////////////////////////////////////////////////////////////
#include <iostream>
using namespace std;
#include "vgl.h"
#include "LoadShaders.h"
enum VAO_IDs { Triangles, NumVAOs };
enum Buffer_IDs { ArrayBuffer, NumBuffers };
enum Attrib_IDs { vPosition = 0 };
GLuint VAOs[NumVAOs];
GLuint Buffers[NumBuffers];
const GLuint NumVertices = 6;

//---------------------------------------------------------------------
//
// init
//
void
init(void)
{
glGenVertexArrays(NumVAOs, VAOs);
glBindVertexArray(VAOs[Triangles]);
GLfloat vertices[NumVertices][2] = {
{ -0.90, -0.90 }, // Triangle 1
{ 0.85, -0.90 },
{ -0.90, 0.85 },
{ 0.90, -0.85 }, // Triangle 2
{ 0.90, 0.90 },
{ -0.85, 0.90 }
};
glGenBuffers(NumBuffers, Buffers);
glBindBuffer(GL_ARRAY_BUFFER, Buffers[ArrayBuffer]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices),
vertices, GL_STATIC_DRAW);
ShaderInfo shaders[] = {
{ GL_VERTEX_SHADER, "triangles.vert" },
{ GL_FRAGMENT_SHADER, "triangles.frag" },
{ GL_NONE, NULL }
};
GLuint program = LoadShaders(shaders);
glUseProgram(program);
glVertexAttribPointer(vPosition, 2, GL_FLOAT,
GL_FALSE, 0, BUFFER_OFFSET(0));
glEnableVertexAttribArray(vPosition);
}

void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBindVertexArray(VAOs[Triangles]);
glDrawArrays(GL_TRIANGLES, 0, NumVertices);
glFlush();
}

//---------------------------------------------------------------------
//
// main
//
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutInitWindowSize(512, 512);
glutInitContextVersion(4, 3);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutCreateWindow(argv[0]);
if (glewInit()) {
cerr << "Unable to initialize GLEW ... exiting" << endl;
exit(EXIT_FAILURE);
}
init();
glutDisplayFunc(display);
glutMainLoop();
}


If you have any information on how either of these programs could be compiled using gcc through the command line I would greatly appreciate it, thank you.

Dark Photon
03-21-2014, 05:00 AM
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.

For that first code fragment, you're going to need to link with the modules providing the interfaces defined in GLTools.h and GLShaderManager.h. That is, whatever libs or object files define GLBatch, GLShaderManager, shaderManager, triangleBatch, GLT_SHADER_IDENTITY, and gltSetWorkingDirectory. These are not OpenGL, GLUT, or GLEW symbols.

Also, add the following to the top of this module for completeness:



#include <stdio.h>
#include <GL/glew.h>


What's you're goal here? Are you looking for some example code with few dependencies you can start from? What ideally would you like this example program to do?

Amad3u5
03-21-2014, 08:15 AM
All I am trying to do is compile opengl code using gcc through the command line, the only way I am able to do it right now is with visual studio express 2008 and I don't want to use that.

Amad3u5
03-21-2014, 08:16 AM
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

mhagain
03-21-2014, 05:24 PM
only way I am able to do it right now is with visual studio express 2008 and I don't want to use that.

Can you give us a VALID reason for not wanting to? So far you've given reasons based on unfounded paranoia and OS-war zealotry. It's just tools, they're not worth getting so worked-up over.

Also - you've spammed cross-posts of this all over the forum. Please don't do that. Once is enough.

A final word of advice: if you'd posted this on gamedev.net or a Stack Exchange site you would have been downvoted to oblivion (on the former you would have been even risking a permanent ban, I think). Coming in with a flamebait attitude backed up by an inability to use the tools you've chosen, and a religious rather than pragmatic reason for choosing those tools you're unable to use -- not good. Not good at all.

Amad3u5
03-21-2014, 06:38 PM
Hey idiot I gave you a valid reason, microsoft is try to kill opengl so why would I want to use their compiler? Because I don't want to use VS is a valid enough reason jerk. I don't see it getting replied to so I was trying to get a bigger audience. WTF is a flamebait attitude? Man you are a real asshole, you must be microsoft's bitch troll. I don't want to be a slave to microsoft so I want to use open source, open source always and forever. Tell me what is wrong with asking this question?

I am working with two professors from the University of Minnesota on this with 60 years of programming experience between them and they don't how to do this, so saying "backed up by an inability to use the tools you've chosen, and a religious rather than pragmatic reason for choosing those tools you're unable to use -- not good.", is a really dumb thing to say. I have been working with them every day for the last three months to do this and only after we exhausted all of our knowledge did I turn here. Would you like their email addresses so you can tell them what shitty programmers they are?

Wait are you an admin, ummm no. So stfu, I don't care about your advice at all. Posted to both sites just for you.

But you are correct about one thing, the hackers code of ethics is my religion.

Agent D
03-22-2014, 03:49 AM
I don't want to be a slave to microsoft so I want to use open source, open source always and forever.
Your statement becomes pretty ironic considering that you're using gcc on Windows(R). I must say at this point that I am supporter of Free Software (http://www.gnu.org/philosophy/free-sw.html) (the thing you call "Open Source" (https://www.gnu.org/philosophy/open-source-misses-the-point.html)) and try to exclusively use Free Software for ideological reasons, but from reading your posts I get the impression you don't really understand the philosophy of either. Your selective objection to some MS products appears to have no other reason than paranoia and OS-war zealotry. I suggest reading up on the links I posted.


Tell me what is wrong with asking this question?
There's nothing wrong with the question, the real problem is you cross posting the same question all over the place.


Hey idiot ..... Because I don't want to use VS is a valid enough reason jerk. .... Man you are a real asshole, you must be microsoft's bitch troll.
...
Wait are you an admin, ummm no. So stfu, I don't care about your advice at all. Posted to both sites just for you.
...
But you are correct about one thing, the hackers code of ethics is my religion.

:doh:



I am working with two professors from the University of Minnesota on this with 60 years of programming experience between them and they don't how to do this, so saying "backed up by an inability to use the tools you've chosen, and a religious rather than pragmatic reason for choosing those tools you're unable to use -- not good.", is a really dumb thing to say. I have been working with them every day for the last three months to do this and only after we exhausted all of our knowledge did I turn here. Would you like their email addresses so you can tell them what shitty programmers they are?
60 years of programming experience? Who are you working with, Grace Hopper? Also, one thing you should have learned at university by now is that having a fancy degree doesn't make you a supperior human beeing. At my university, I run into people with a doctors degree in CS who claim to be security experts and don't know what an HTTP request looks like and at what layer to put the IP address in the OSI model, at a daily basis.
Also, knowing one programming language doesn't automatically make you good at every programming language.

I guess there's a lack of understanding of and experience with the C programing language here, as there obviously are some macros for calling conventions and what not used in glu.h that are not defined in your programm (remember, your compile log). Since you're using Windows(R) (not wanting to be a Microsoft(R) slave of course), I guess they are in <windows.h>

Aleksandar
03-22-2014, 08:59 AM
Hey idiot I gave you a valid reason, microsoft is try to kill opengl so why would I want to use their compiler? Because I don't want to use VS is a valid enough reason jerk. I don't see it getting replied to so I was trying to get a bigger audience. WTF is a flamebait attitude? Man you are a real asshole, you must be microsoft's bitch troll.

This qualifies you to be banned on this site also!


microsoft is try to kill opengl
This is the greatest nonsense I've recently heard. What operating systems are you using? Windows? Period!
No other comments are necessary. Windows is currently the best environment to develop OpenGL programs.


I don't want to be a slave to microsoft so I want to use open source, open source always and forever. Tell me what is wrong with asking this question?
That's OK as long as you allow others to tell you their opinions. Especially if they have a much more experiences than you. At least, that's the part of good manners.


I am working with two professors from the University of Minnesota on this with 60 years of programming experience between them and they don't how to do this, so saying "backed up by an inability to use the tools you've chosen, and a religious rather than pragmatic reason for choosing those tools you're unable to use -- not good.", is a really dumb thing to say.
You have problems on the start. The problems will be bigger when you come to some serious usage. As some others already told you no the Gamesdev, there is no support for your environment. It is irrational to develop something in the old and unsupported environment. Instead of insulting other people try to understand what they try to tell you. Have you ever heard about GL debugging and profiling tools? How many of them are supported by Dev C++?


I have been working with them every day for the last three months to do this and only after we exhausted all of our knowledge did I turn here. Would you like their email addresses so you can tell them what shitty programmers they are?
And some of us have several decades of serious programming and also teaching at the university (both graphics and programming). Do you think you are qualified to insult us with just three moths of working with whoever it is?

It is not easy to be a good programmer (or engineer) but it is even harder to be a good man. Please, consider your manner in the communication! It is a friendly advice. This is one of the best forums in the Universe about OpenGL. Instead of quarreling, try to learn something, and the advances will be inevitable.

Amad3u5
03-22-2014, 09:17 AM
If you guys aren't smart enough to solve this problem or read don't post and I am reporting all of you for being abusive and not helpful.

Agent D
03-22-2014, 09:25 AM
In my post above, I suggested including windows.h before glu.h, as it contains all the undefined macros used in glu.h

Have you already tried that, or are you too busy insulting people?

Amad3u5
03-22-2014, 09:25 AM
You can't read.

dorbie
03-22-2014, 09:43 AM
Enough of the flames, all of you.

Amad, I'm not going to censor this discussion. Some topics are flamebait and you've not just been on the receiving end. I suggest you ignore the insults and focus on the meat of the advice given.

Visual Studio is a first class IDE. The developers at AMD and NVIDIA develop their windows platform OpenGL drivers using it. Move past the politics and use the best tools for the job on the platforms you use. John Carmack who's done more for OpenGL on Windows than most uses Visual Studio. It's all about productivity when you pick tools like this so start with the smart decision. It's YOUR productivity you're sacrificing, and this thread is only the first hit you're taking to that productivity.

OpenGL is just another library, if you want to use it with any compiler it works the same way as all the other libraries you link to on Windows, so your question is more of a generic compilation issue rather than an OpenGL one.

Best of luck.

dorbie
03-22-2014, 09:48 AM
P.S.

From your link line: -lopengl21

Eh? You may want to double check that lib name.

Amad3u5
03-22-2014, 09:54 AM
Thank you very much for all your help.

Amad3u5
03-22-2014, 10:01 AM
yeah is should have been -lopengl32, fingers in wrong spot there.

Amad3u5
03-22-2014, 12:21 PM
As far as I know microsoft is trying to kill opengl, so I don't understand why the community would want to use their compiler? I don't understand why this is a bad question. And becoming dependent on microsoft is a slippery slope, they don't make us pay now but what happens when we all become dependent on them? I'll tell you what will happen, they will make us pay.

mhagain
03-22-2014, 01:25 PM
As far as I know microsoft is trying to kill opengl, so I don't understand why the community would want to use their compiler? I don't understand why this is a bad question. And becoming dependent on microsoft is a slippery slope, they don't make us pay now but what happens when we all become dependent on them? I'll tell you what will happen, they will make us pay.

This is bad because it's the old API war that played out 18 years ago and everybody is totally sick of it now. There's nothing new to be said that hasn't been said many many times before. It's also totally untrue - Microsoft were never trying to kill OpenGL; quite the opposite: they desperately wanted to break into the graphics workstation market and needed OpenGL for that.

Amad3u5
03-22-2014, 01:37 PM
Ok, thanks for a good response

Amad3u5
03-22-2014, 07:27 PM
I installed TDM-GCC and I am getting the same error messages

mhagain
03-23-2014, 02:40 AM
The reason why you're getting these errors is because you've got a #include dependency either missing or specified in the wrong order. If you look at the glu.h file that the errors are coming from, you'll see lines that look like the following:


const GLubyte* APIENTRY gluErrorString (
GLenum errCode);

In this case, your compiler would be telling you that (1) it doesn't know what a GLubyte is, (2) it doesn't know what APIENTRY means, and (3) it doesn't know what a GLenum is. This is what Agent D was telling you on the previous page: you just have to identify what these dependencies are, and resolve them.

This, by the way, is absolutely basic "how to use your tools" stuff so as a word of friendly and well-intentioned advice: if your two professors with 60 years of experience don't know how to resolve this after working on it every day for 3 months, you should be seriously thinking about continuining your education elsewhere.

Amad3u5
03-23-2014, 09:12 AM
Thanks, on other gamedev.net people told me to use TDM-GCC because you need to use an up to date compiler, so I am using that now.

Amad3u5
03-23-2014, 09:13 AM
So I guess I will not have to work on getting my dependencies correct and in the right order now.

Amad3u5
03-23-2014, 11:48 AM
So I am now able to compile from the command line using gcc. The answer to my question is that I need to get the newest version of gcc and use this for my 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

Amad3u5
03-24-2014, 04:29 PM
I have found that SB creates and uses their own libraries. GLTools.h is one of those libraries. These tools are specifically designed to run on MSVS express 2008. To get the library defined (I am just figuring this our right now), I think you have to do this:



1 Go to freeglut's site and download the latest version (currently 2.6.0)

2. Create a c:/libs directory, and unpack the freeglut package there. You should end up with a directory called c:/libs/freeglut-2.6.0.

3.Run MSYS (c:/MinGW/msys/1.0/msys.bat). You should be in your home directory (denoted by ~ after your user and host in the top line).

4.Type "cd /c/libs/freeglut-2.6.0/src" and press [enter]. The ~ will change to /c/libs/freeglut-2.6.0/src to denote your current working directory.

5.Type "gcc -O2 -c -DFREEGLUT_STATIC *.c -I../include" and press [enter]. What we are doing here is calling the gcc compiler, instructing it to use O2 optimization, set the flag FREEGLUT_STATIC, and compile every source file in this directory into .o object files, and to look for headers in "../include". That means to go down one level (to /c/libs/freeglut-2.6.0) and look for the /include directory there.

6.Type "ar rcs libfreeglut32_static.a *.o" and press enter. To the best of my understanding, ar is the utility that compiles static libraries, archive files (.a). We're telling it to create "libfreeglut32_static.a" from every object file (.o) we just compiled in the previous step.

7.Create a /lib directory in /c/libs/freeglut-2.6.0. Then cut the library we just created and paste it in this directory. The final location of the freeglut library should be "c:/libs/freeglut-2.6.0/lib/libfreeglut32_static.a".

Amad3u5
03-24-2014, 04:33 PM
I am sorry for the flame bait at the beginning of this post. I have never posted anything to a opengl community before and I didn't know it was such a big deal to address issues that I thought to be technical. I am just learning about how stuff works in this community and thank you for your patience