I keep getting an error with the cpp that asks if I forgot to include stdafx.h, which I have done in the header, the error code is C1010.
The full error reads: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
First I have a header file which defines some basic functions for a calculator. Which accept arguments when called.
#pragma once
#include <iostream>
#include <string>
#include "stdafx.h"
using namespace std;
class Functions
{
public:
Functions() {};
float add(float a, float b);
float subtract(float a, float b);
float multiply(float a, float b);
float divide(float a, float b);
private:
float answer;
};
Then there's the cpp which simply computes the 2 arguments and returns the answer.
#pragma once
#include "Functions.h"
float Functions::add(float a, float b)
{
answer = a + b;
return answer;
}
float Functions::subtract(float a, float b)
{
answer = a - b;
return answer;
}
float Functions::multiply(float a, float b)
{
answer = a * b;
return answer;
}
float Functions::divide(float a, float b)
{
answer = a / b;
return answer;
}
Please explain in simple terms, I'm not very good at coding.
usinginside a header file - Adrian Cornish#pragma onceto a cpp file it doesn't do anything useful - Adrian Cornish