Archived

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

Quasimodo

Strange error

Recommended Posts

Hi, I''m new to this forum and game programming. My first project is a game set in space. Not very original, but I hope I will be able to add some twist. The code I''m having problem with is the physics. If somebody could help me with identifying the problem, or point me in the right direction, I would be very grateful. The error: c:\program\microsoft visual studio\myprojects\algotest\phsys.cpp(144) : fatal error C1010: unexpected end of file while looking for precompiled header directive void vTable::calcVTable(double f)//Calculate the vTable { int i; for (i=0;i<=359;i++)//Repeat for each angle { v.x = sin(i) * f;//Store the x component of the force v[i].y = cos(i) * f;//Store the y component of the force } }//This is line 144 and the end of the file Kind regards Hugo

Share this post


Link to post
Share on other sites
Just a blind shot:

Perhaps you need to link a math library for the sin() and cos() functions. Also, did you include something like math.h?

I don''t know anything about MVS, but check for that. I had similar errors using GCC under Linux and Solaris and linking to libm ususally solved my problems.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
No, sorry, misread your post...

You probably forgot to #include "stdafx.h" or whatever your precompiled header is called.

Share this post


Link to post
Share on other sites
Thanks for the quick replies. The file with the main loop includes "stdafx.h" and "phsys.cpp". These are preprocessor commands that I use in "phsys.cpp".

//Math lib
#if !defined(_INC_MATH)
#include <math.h>
#endif

//The value of pi
#if !defined(PI)
#define PI 3.14159265358979323846f
#endif

//Radians<->Degrees
#if !defined(TO_RADIANS)
#define TO_RADIANS(x) ( ((x) * PI) / 180 )
#endif

#if !defined(TO_DEGREES)
#define TO_DEGREES(x) ( ((x) / PI) * 180 )
#endif

Edited by - Quasimodo on July 22, 2001 12:06:32 PM

Share this post


Link to post
Share on other sites
But are you including stdafx.h in your phsys.cpp file?

All .cpp files must include stdafx.h if you created it as a Win32 project in MSVC, regardless of whether it was previously included.

Seeya
Krippy

Share this post


Link to post
Share on other sites