PDA

View Full Version : Opengl and windows xp



slx47
05-08-2002, 11:28 AM
I cant compile my programs right. I am using windows xp. I was wondering if it had problems on xp or it doesnt run at all on xp ?

Deiussum
05-08-2002, 12:06 PM
More info is needed to answer your question... Like... what compiler do you use? What errors you are getting? What is the air speed velocity of an unladen sparrow?

yakuza
05-08-2002, 12:06 PM
OpenGL both compiles and runs on XP.

What compiler are you using, what errors are you seeing, are you able to compile on other machines, etc....

slx47
05-08-2002, 12:10 PM
Ok im using: dev 4 c++

and heres my problem:

the linker has a problem:
c:\documents and settings\ralph\my documents\untitled1.o(.text+0xf):untitled1.cpp: undefined reference to `glClear@4'
c:\documents and settings\ralph\my documents\untitled1.o(.text+0x17):untitled1.cpp: undefined reference to `glFlush@0'
c:\documents and settings\ralph\my documents\untitled1.o(.text+0x39):untitled1.cpp: undefined reference to `glClearColor@16'
c:\documents and settings\ralph\my documents\untitled1.o(.text+0x5d):untitled1.cpp: undefined reference to `glutInitDisplayMode@4'
c:\documents and settings\ralph\my documents\untitled1.o(.text+0x6d):untitled1.cpp: undefined reference to `glutCreateWindow@4'
c:\documents and settings\ralph\my documents\untitled1.o(.text+0x7d):untitled1.cpp: undefined reference to `glutDisplayFunc@4'
c:\documents and settings\ralph\my documents\untitled1.o(.text+0x8a):untitled1.cpp: undefined reference to `glutMainLoop@0'


and my code is:

#include <windows.h>
#include <gl/glut.h>

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


// Flush drawing commands
glFlush();
}

// Setup the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}


// Main program entry point
void main(void)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);

SetupRC();

glutMainLoop();
}



[This message has been edited by slx47 (edited 05-08-2002).]

jmathies
05-08-2002, 01:51 PM
"the linker has a problem:"
Not the compiler. Your not linking
to the GL, and GLUT libs.

Try adding:

#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")
#pragma comment (lib, "glut32.lib")

And make sure you have GLUT installed
on your machine.

Regards,
Jim

slx47
05-08-2002, 04:20 PM
that didnt do anything !

Syslock
05-08-2002, 10:03 PM
What he's saying is that you need more than just OpenGL headers.

You need to add the glut32.lib and glu32.lib files to your project.

Find them on your hard drive. They should be in the MSVC++ folders
somewhere.

If you don't have them, then search the web for them.

[This message has been edited by Syslock (edited 05-09-2002).]

slx47
05-09-2002, 02:11 AM
ok that helped, but i still have a few little problems, I am using dev-C++.

the linker says:

C:\DEV-C_~1\Bin\ld.exe: C:\Dev-C++\Lib\OPENGL32.LIB(OPENGL32.dll): warning: ignoring duplicate section `.text'
C:\DEV-C_~1\Bin\ld.exe: C:\Dev-C++\Lib\OPENGL32.LIB(OPENGL32.dll): warning: ignoring duplicate section `.idata$5'
C:\DEV-C_~1\Bin\ld.exe: C:\Dev-C++\Lib\OPENGL32.LIB(OPENGL32.dll): warning: ignoring duplicate section `.text'
C:\DEV-C_~1\Bin\ld.exe: C:\Dev-C++\Lib\OPENGL32.LIB(OPENGL32.dll): warning: ignoring duplicate section `.idata$5'
C:\Dev-C++\Lib\glut32.lib: file not recognized: File format not recognized

and my code is:

#include <windows.h>
#include <gl/glut.h>

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


// Flush drawing commands
glFlush();
}

// Setup the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}


// Main program entry point
void main(void)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);

SetupRC();

glutMainLoop();
}

bakery2k
05-09-2002, 03:22 AM
I suspect you have found .lib files for microsoft vc++ rather than your own dev c++.
You need to find .lib files generated for dev c++, so they will not be found in the MSVC folder.
btw, adding

#pragma comment(lib,...)

does not work, since that is MS VC++ specific.

mikael_aronsson
05-10-2002, 11:50 AM
Hi !

DevCPP uses the MinGW32 compiler (that's the gcc compiler for Windows), so you need to use .a files not .lib files, your compiler does not work with the normal .lib files.

Mikael

jmathies
05-12-2002, 08:29 AM
Ahh sorry, didn't catch that dev 4 c++ stuff.
I didn't know about this.. according to
the home page:

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

So maybe get the Mingw or Cygwin opengl/glut libs
instead? That should fix the problem.

Regards,
Jim

VS.NET-XP
05-30-2002, 08:43 AM
Hi, where do I had the #pragma lines, I am using Visual Studio .NET and Windows XP get a similar error message dealing with references. As well as a fatal error C1010: unexpected end of file while looking for precompiled header directive.


Originally posted by jmathies:
Ahh sorry, didn't catch that dev 4 c++ stuff.
I didn't know about this.. according to
the home page:

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

So maybe get the Mingw or Cygwin opengl/glut libs
instead? That should fix the problem.

Regards,
Jim

Deiussum
05-30-2002, 09:39 AM
As well as a fatal error C1010: unexpected end of file while looking for precompiled header directive.


That's caused from your project being setup to use precompiled headers, and you not including "stdafx.h" in one of your source files (or whatever happens to be defined as the precompiled header)

Either turn off precompiled headers in the project, or include that. (I'm not sure offhand where the setting is in VS.Net. I use VS.Net at work, but only for C# stuff and never for any OpenGL.)

jpummill
05-30-2002, 10:24 AM
Deiussum,

I think you mean an unladen swallow (African or European http://www.opengl.org/discussion_boards/ubb/smile.gif!!!

VS.NET-XP
05-30-2002, 11:44 AM
Added the stdafx.h file and for some odd reason it compiled this time. http://www.opengl.org/discussion_boards/ubb/confused.gif Comes up to the screen but only a blank white screen now. I still working on it. Let me know if there is any other suggestions.


Originally posted by Deiussum:
That's caused from your project being setup to use precompiled headers, and you not including "stdafx.h" in one of your source files (or whatever happens to be defined as the precompiled header)

Either turn off precompiled headers in the project, or include that. (I'm not sure offhand where the setting is in VS.Net. I use VS.Net at work, but only for C# stuff and never for any OpenGL.)

Deiussum
05-31-2002, 04:24 AM
Originally posted by jpummill:
Deiussum,

I think you mean an unladen swallow (African or European http://www.opengl.org/discussion_boards/ubb/smile.gif!!!



Ooops, yup. You're right.

African or European?
I don't know that! http://www.opengl.org/discussion_boards/ubb/smile.gif

Deiussum
05-31-2002, 04:28 AM
If by a white screen you mean you get your glut window but it just displays white, then the problem now most likely lies in your OpenGL code, not the Glut code. There are a number of things that could cause that.