I've got: frw_trafic.h:
#define PI 3.14159265
namespace FRW
{
float angleToProperRadians(float angle);
class Car
{
public:
...
void transform(int time = 1);
...
private:
...
float velocDir; // angle in degrees, same as Sector angle
float wheelDir; // hence delta angle between car velocity direction and where wheels drive direction
float centerPosX;
float centerPosY; //these two are for car position
... }; }
Here is a namespace with a class and a method declared. frw_traffic.cpp
#ifndef FRWTRAFFIC
#define FRWTRAFFIC
#include "frw_traffic.h"
#endif
#include <cmath>
using namespace FRW;
float angleToProperRadians(float angle)
{
for (; angle < -360 || angle > 360;)
{
if (angle < -360)
{
angle = angle + 360;
continue;
}
if (angle > 360)
{
angle = angle - 360;
}
}
if (angle < 0)
{
angle = 360 - angle;
}
return angle * PI / 180;
}
void Car::transform(int time) {
if (wheelDir == 0)
{
centerPosX = centerPosX + static_cast<float>(time) * speed * cos(FRW::angleToProperRadians(velocDir)) ;
centerPosY = centerPosY + static_cast<float>(time) * speed * sin(FRW::angleToProperRadians(velocDir)) ;
} }
Method angleToProperRadians() is declared in .h, defined in .cpp and uses for calculations a macro PI, which is defined in .h. Then, I calculate objects position in a line-trajectory with method Car::tranform(). It is also declared in an .h file as a part of a Car class, and defined in .cpp file.
This code fails to compile, giving the "Unresolved external symbol." error. AFA this is a linkage error, I believe something is messed up with macros or includes. I've been desperately trying to get use of other questions about this error here, on Stack Overflow, however most of the people meet this error whilst using external libraries.
Please, somebody, provide an advice on what to check twice to see what's really wrong with this code.
error LNK2019: unresolved external symbol "float __cdecl FRW::angleToProperRadians(float)" (?angleToProperRadians@FRW@@YAMM@Z) referenced in function "public: void __thiscall FRW::Car::transform(int)" (?transform@Car@FRW@@QAEXH@Z)
Thank you.