Opengl and windows xp

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 ?

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…

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?

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 toglFlush@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 toglutInitDisplayMode@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 toglutDisplayFunc@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).]

“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

that didnt do anything !

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).]

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

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.

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

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

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:
[b]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

[/b]

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.)

Deiussum,

I think you mean an unladen swallow (African or European !!!

Added the stdafx.h file and for some odd reason it compiled this time. 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:
[b] 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.)

[/b]

Originally posted by jpummill:
[b]Deiussum,

I think you mean an unladen swallow (African or European !!!

[/b]

Ooops, yup. You’re right.

African or European?
I don’t know that!

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.