separate compilation problem

Hey guys, i have three different files 1 header and 2 cpp files i'm trying to compile but it keeps giving me this
"unexpected tokens following preprocessor directive - expected a newline"
This is my header file
#ifndef Dias_ball.h
#define Dias_ball.h
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>

using namespace std;

const double DENSITYAIR=0.0013;
const double DENSITYWATER=1;
const double PI=3.141592653589793238462;

class Ball {
public:
Ball();
Ball(double r,double m);
void makeBigger(int multiplier);
void makeHeavier(int multiplier);
double getSurfaceArea() const;
double getVolume() const;
double getDensity() const;
bool doesItFloat() const;
bool doesItFly() const;
bool operator<(Ball b) const;
bool operator>(Ball b) const;

private:
double mass;
double radius;
};

#endif


this is my function file

#include <iostream>
#include "Dias_ball_h"


Ball::Ball() {
radius=0; //cm
mass=0; //grams
}

Ball::Ball(double r,double m) {
radius=r; //cm
mass=m; //grams
}

void Ball::makeBigger(int multiplier) {
radius*=multiplier;
}

void Ball::makeHeavier(int multiplier) {
mass*=multiplier;
}

double Ball::getSurfaceArea() const {
return (4.0)*PI*pow(radius,2);
}

double Ball::getVolume() const {
return (4.0/3.0)*PI*pow(radius,3); //cm^3
}

double Ball::getDensity() const {
return mass/getVolume(); // g/cm^3
}

bool Ball::doesItFloat() const {
return getDensity() < DENSITYWATER;
}

bool Ball::doesItFly() const {
return getDensity() < DENSITYAIR;
}

bool Ball::operator < (Ball b) const {
return mass < b.mass && radius<b.radius;
}

bool Ball::operator > (Ball b) const {
return mass > b.mass && radius>b.radius;
}


and this is my main file which its just basic so i can see if i can get it to work before moving on but i can't get past that error for a couple hours now.
#include <iostream>
#include "Dias_ball_h"


int main()
{
double r;
double m;

ifstream balldata ( "c:\\workarea\\balldata.txt", ios::in);

if (!balldata)
{
cout<< "Error opening" <<balldata << "\n";
return 1;
}

/*Ball solution;


while (balldata >> r >> m)


//if (solution.getDensity() < solution.DENSITYWATER)

cout << "Volume:" << solution.getVolume;
cout << "Density:" <<solution.getDensity;
cout << "Surface Area:"<<solution.getSurfaceArea;
*/
return 0;

}


file which its just basic so i can see if i can get it to work before moving on but i can't get past that error for a couple hours now. Does anyone see anything wrong or it couple be my ide thats not working correctly?
1
2
#ifndef Dias_ball.h
#define Dias_ball.h 


The "." is out of place. Usually you would use an underscore in it's place.
Topic archived. No new replies allowed.