Click to See Complete Forum and Search --> : Symbol Referencing Error


Delpheno
January 31st, 2008, 07:18 PM
I don't know what I'm doing wrong here. Everything looks okay, but I get a Symbol Referencing Error when I compile.

Header:
------------------------------------------
inline double DegreesToRadians( double Degrees );
inline double RadiansToDegrees( double Radians );
--------------------------------------------

Functions:
------------------------------------------
using namespace std;

#include <iostream>
#include <iomanip>
#include "proj03.library.h"

#include <cmath>

double DegreesToRadians( double Degrees )
{
return Degrees / 180 * 3.1416;
}

double RadiansToDegrees( double Radians )
{
return Radians * 180/3.1416;
}
------------------------------------------------------------

Main:
-----------------------------------------------------------
using namespace std;

#include <iostream>
#include <iomanip>
#include "proj03.library.h"

int main()
{
cout << DegreesToRadians( 45 );
cout << RadiansToDegrees( 1 );
}
----------------------------------------------------------

Output:
----------------------------------------------------------
proj03.library.h:1: warning: inline function `double DegreesToRadians(double)' used but never defined
proj03.library.h:2: warning: inline function `double RadiansToDegrees(double)' used but never defined
Undefined first referenced
symbol in file
DegreesToRadians(double) /var/tmp//ccnvuYnr.o
RadiansToDegrees(double) /var/tmp//ccnvuYnr.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
-----------------------------------------------------------------

WHAT IN THE WORLD IS GOING ON. I've spent hours on this already. If anyone understands what's wrong, please help me.

Plasmator
January 31st, 2008, 08:21 PM
Just a shot in the dark, but this looks suspect:

using namespace std;

#include <iostream>
#include <iomanip>
#include "proj03.library.h"

#include <cmath>

//...
Your "using namespace" statement goes after your standard header inclusions.
Also, next time, please use code tags. Thanks!

kenrus
February 1st, 2008, 03:07 PM
I am assuming the functions:

inline double DegreesToRadians( double Degrees );
inline double RadiansToDegrees( double Radians );

are prototyped inside the "proj03.library.h" header file?

Are the definitions of the functions inside the same source module as main()?