I'm getting an unresolved symbols linking error with this code, the cpp files compile successfully separately, I just can't build the solution and run it. any ideas?

header.h

#include <iostream>
#include <string>
using std::string;
using namespace std;

class Double
{
private:
	double dub; 
	char str[50];
public:
	Double();
	Double(char s[50]);
	Double(double a);
	void toDouble(char str[50]);
	void toString();
	void printClass();
	void equal(char str[50]);
	void equal(double dub);
	bool isNAN(char s[50]);




};

double.cpp

#include <math.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <string.h>
#include <conio.h>
#include "header.h"
using namespace std;

Double::Double()
{
}

Double::Double(char s[50])
{
	strcpy(str, s);
}

Double::Double(double a)
{
	dub=a;
}

void Double::toDouble(char str[50])
{
	if(!isNAN(str))
		dub = atof(str);
}

void Double::toString()
{
	sprintf(str,"%f",dub);
}

void Double::equal(char s[])
{
	strcpy(str, s);
}

void Double::equal(double d)
{
	dub=d;
}

bool isNAN(char s[])
{
	string str=s;
	cout<<s<<endl;
	cout<<str<<endl;
	for(int i=0; i<str.size(); i++)
	{
		if(!isdigit(s[i]))
			return true;
	}
	return false;
}



void Double::printClass()
{
	cout<<dub<<endl;
	cout<<str<<endl;
}

main.cpp

#include <iostream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <string.h>
#include <conio.h>
#include "header.h"
using namespace std;
int printMenu();
void waitKey();

const int ADDSTRING=1;
const int ADDDOUBLE=2;
const int EXIT=3;

int main()
{
	char s[50]="123.223h";
	Double d, str(*s), dubble(123.233);
	d.toDouble("123.222h");
}

Try adding header guards in header.h

#ifndef HEADER_H
#define HEADER_H

#include <iostream> // put your includes in the header file so you don't need to include them in every file that uses this header
#include <...>

class blah_blah
{
};
...

#endif

That didn't fix it, heres the error im getting by the way, I guess I shoudl have included it the first time around

1>double.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Double::isNAN(char * const)" (?isNAN@Double@@QAE_NQAD@Z) referenced in function "public: void __thiscall Double::toDouble(char * const)" (?toDouble@Double@@QAEXQAD@Z)
1>E:\C++ Level 2\Midterm\Debug\Midterm.exe : fatal error LNK1120: 1 unresolved externals

ohh duh, nevermind, when I defined the isNAN() function i forgot to name it as part of a class

bool Double::isNAN(char str[])
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.