Strange error
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.y = cos(i) * f;//Store the y component of the force
}
}//This is line 144 and the end of the file
Kind regards Hugo </i>
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.
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.
It sounds like you have an #if without a terminating #endif or similar, or perhaps an incorrect macro-invocation.
July 22, 2001 06:39 AM
No, sorry, misread your post...
You probably forgot to #include "stdafx.h" or whatever your precompiled header is called.
You probably forgot to #include "stdafx.h" or whatever your precompiled header is called.
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
//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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement