Archived

This topic is now archived and is closed to further replies.

flucknugget

OpenGL problem

Recommended Posts

flucknugget    122
I''m trying to compile an OpenGL program that draws a triangle, and that''s it, and I''m getting this error. c:\code\msvc\opengl test\opengl test.cpp(163) : fatal error C1010: unexpected end of file while looking for precompiled header directive I included , , and . I linked opengl32.lib, glu32.lib, and glaux.lib. Is there anything else I need to do? - f l u c k y p o o - the geek inside

Share this post


Link to post
Share on other sites
henrym    103
If you are using MSVC++ (which I assume you are) you can get rid of the '/Fp' and '/Yc' compiler options by:

Goto (menu)Project->Settings then goto the C++ Tab, and then goto the 'Project Options:' textbox and remove the '/Fp******.pch' and remove '/Yc******.h'

That should fix it. I think those switches create Precompiled headers which may be faster to compile? Im not quite.

Check MSDN Library for more information.(/Fp /Yc) Also, please note that this is my first post of any help so I may be wrong, but, this has been my experience with precompiled headers...

Henry.



[Edit: links]




[edited by - henrym on May 3, 2002 2:33:03 AM]

Share this post


Link to post
Share on other sites
An easy way to turn off precompiled headers for a single cpp file (in MSVC++) is to go to project->settings.

Then select the cpp file (in the left tree view thingy) you wish to disable precompiled headers for. Click the C/C++ tag, then select precompiled headers from the Catergory drop down box, then finally choose the "Not using precompiled headers" radio box.

Hope this helps.

Share this post


Link to post
Share on other sites
Turnig off precompiled headers is one option (see the other posts). But precompiled headers are by no means useless, especially when you have a large project: they will reduce your compilation time. The trick is to buid the project, in order for the precompiled header to be generated.

This means:
1. generate a new project
2. Add some code
3. instead of compiling a file build the project

IIRC, you need to do this pnly once, as long as you don''t modify stdafx.h (wich you shouldn''t!)

HTH

Forever trusting who we are
And nothing else matters
- Metallica

Share this post


Link to post
Share on other sites
flucknugget    122
Ok, I tried going and removing all the /Fc and /Yc stuff, only there wasn''t any /Yc stuff. So I just removed the /Fc, and that didn''t fix it. Then I told my project to use no precompiled headers, and I got a bunch of Windows errors, I think because it wasn''t using stdafx.h. So I put that back.. and it still doesn''t work. I remember a long time ago, the first time I was trying to get OpenGL to work it just worked fine without chaging any funky compiler options. Are you supposed to have to do this for each project?


- f l u c k y p o o
- the geek inside

Share this post


Link to post
Share on other sites
flucknugget    122
Well, right now I only have one file since this is just a little opengl test program to try and set the graphics mode and draw a triangle. Here are the errors I get when I disable all the precompiled headers.

c:\code\msvc\opengl test\main.cpp(113) : error C2664: ''RegisterClassA'' : cannot convert parameter 1 from ''struct tagWNDCLASSEXA *'' to ''const struct tagWNDCLASSA *''
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\code\msvc\opengl test\main.cpp(148) : error C2065: ''glTranslate'' : undeclared identifier
c:\code\msvc\opengl test\main.cpp(148) : error C2059: syntax error : ''bad suffix on number''
c:\code\msvc\opengl test\main.cpp(148) : error C2146: syntax error : missing '')'' before identifier ''f''
c:\code\msvc\opengl test\main.cpp(148) : error C2059: syntax error : ''bad suffix on number''
c:\code\msvc\opengl test\main.cpp(148) : error C2059: syntax error : '')''
c:\code\msvc\opengl test\main.cpp(149) : error C2065: ''glRotate'' : undeclared identifier
c:\code\msvc\opengl test\main.cpp(153) : error C2059: syntax error : ''bad suffix on number''
c:\code\msvc\opengl test\main.cpp(153) : error C2146: syntax error : missing '')'' before identifier ''f''
c:\code\msvc\opengl test\main.cpp(153) : error C2660: ''glVertex3f'' : function does not take 2 parameters
c:\code\msvc\opengl test\main.cpp(153) : error C2059: syntax error : ''bad suffix on number''
c:\code\msvc\opengl test\main.cpp(153) : error C2059: syntax error : ''bad suffix on number''
c:\code\msvc\opengl test\main.cpp(153) : error C2059: syntax error : '')''
Error executing cl.exe.


- f l u c k y p o o
- the geek inside

Share this post


Link to post
Share on other sites
Well the first thing is that on line 113 it looks like you are trying to call RegisterClass with a WNDCLASSEX structure as the parameter. Instead you will need to call RegisterClassEx.

The other errors look like you haven''t includeed the relevent headers and linked to the correct libraries. Although you said you have, so I''m not sure what could be causing them. Make sure you haven''t missed any brackets etc.

Share this post


Link to post
Share on other sites
catfoodgood    122
Go to the OpenGL link in my signature, download Lesson 1, build it, and look at what is different in your headers. Also, I noticed in glVertex3f you only sent it 2 coordinates, so check your code again.

______________________________
[Books] [Reference and Tutorials]
[For Beginners] [IGDA]
[OpenGL Tutorials] [Sourceforge]
[DirectX Tutorials] [Gamasutra]

[edited by - catfoodgood on May 4, 2002 1:41:00 PM]

Share this post


Link to post
Share on other sites
AntilogicHyper    160
c:\code\msvc\opengl test\main.cpp(148) : error C2065: ''glTranslate'' : undeclared identifier its meant to be glTranslatef(0.0f, 0.0f, 0.0f);
glRotatef(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.0f); (you might want glVertex2f )


--------------------------------

Lead Design, Lead Artist
WhitespaceUnlimited

Share this post


Link to post
Share on other sites