#ifndef _EMATH_H_
#define _EMATH_H_
#include "ETypes.h"
//SOME DEFINE AND MACROS
#define PI ((Real32) 3.141592654f)
#define EMATH_DEG_TO_RAD(Real32) (( PI/ 180.0f) * (Real32)) // converts from degrees to radians
#define EMATH_RAD_TO_DEG(Real32) ((180.0f / PI) * (Real32)) // converts from radians to degrees
/* Some handy math stuff*/
//Nice "hax" from ID software
inline Real32 FastInvSqrt (Real32 x)
{
Real32 xhalf = 0.5f*x;
Int32 i = *(Int32*)&x <-- error, Int32 is a type def and will generate ambigious symbol error
i = 0x5f3759df - (i>>1);
x = *(Real32*)&i
x = x*(1.5f - xhalf*x*x);
return x;
}
/* End of handy math stuff*/
//forward declarations
class ECVector3D;
class ECMatrix4;
class ECQuaternion;
etc...
[\code]
Creating a .lib for my math project VS 2008
Hello.
I made a math project that handles Vectos, Matrices and Quaternions. NOe I would like to make a library of it.
I never made one before. I made a static library using Visual Studio 2008 express, but when I try to use it I get an error saying that one of my type def for int generates a ambigious symbol error.
Most likley I faild to creat a correct .lib.
Here is some code that I would like to icnlude in the .lib.
OK I managed to soulve the problem but I have a new one :/
i have one header file
ECMath, where i declare thre classes ECVector3D, ECMatrix4 & ECQuaternion
I made a lib file and included it to a project where i Tested my Vector and it went just fine.
next i Was going to check if my matrices was working. But I couldn't compile when i made a matrix.
error LNK2005: ___@@_PchSym_@00@UwlxfnvmghLzmwLhvggrmthUKsmKsovinzmhhlmUnrmzLwlpfnvmgUvzhbDwnzgs
UvzhbDwnzgsUivovzhvUvxjfzgvimrlmOlyq@ already defined in ECMath.lib(ECMatrix4.obj)
Is this because I have both vector and matrox class declared in the same header??
i have one header file
ECMath, where i declare thre classes ECVector3D, ECMatrix4 & ECQuaternion
I made a lib file and included it to a project where i Tested my Vector and it went just fine.
next i Was going to check if my matrices was working. But I couldn't compile when i made a matrix.
error LNK2005: ___@@_PchSym_@00@UwlxfnvmghLzmwLhvggrmthUKsmKsovinzmhhlmUnrmzLwlpfnvmgUvzhbDwnzgs
UvzhbDwnzgsUivovzhvUvxjfzgvimrlmOlyq@ already defined in ECMath.lib(ECMatrix4.obj)
Is this because I have both vector and matrox class declared in the same header??
The mangled name of the symbol in the linker error contains "_PchSym_". I'd assume that means it has something to do with pre-compiled headers.
Try reading the second post here, and see if that helps.
Try reading the second post here, and see if that helps.
hah can't belive that I didn't find that post, thank's!
To every one else who wan't to create a static library, do NOT move stdafx.h"and all the other visual studio created files to another location and re-add them to your project. If you do you will have to recreate pch and that will cause the error I had. I moved all h/cpp to a subfolder I named source, bad idea!
Ofcourse there are most likley a way to do that safely that I'm not aware of ^^
To every one else who wan't to create a static library, do NOT move stdafx.h"and all the other visual studio created files to another location and re-add them to your project. If you do you will have to recreate pch and that will cause the error I had. I moved all h/cpp to a subfolder I named source, bad idea!
Ofcourse there are most likley a way to do that safely that I'm not aware of ^^
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement