I'm new to C++ and am running through a very simple file. I have one main file and a class (header + src file). however, whenever I run it I get an error.
Here's the source:
main.cpp
#include <iostream>
#include "Gui-Test/div.h"
using namespace std;
int main()
{
div computer;
cout << computer.divide();
return 0;
}
div.h
#ifndef DIV_H
#define DIV_H
class div
{
public:
div();
virtual ~div();
int divide();
protected:
private:
};
#endif // DIV_H
div.cpp
#include "Gui-Test/div.h"
div::div()
{
//ctor
}
div::~div()
{
//dtor
}
int div::divide()
{
return 6;
}
I'm using Gnu Make to compile it which gives the following error when trying to compile the main file into an object
g++ -c src/main.cpp -o objects/main.o -I include
src/main.cpp: In function ‘int main()’:
src/main.cpp:8:9: error: expected ‘;’ before ‘computer’
div computer;
^~~~~~~~
src/main.cpp:8:17: error: statement cannot resolve address of overloaded function
div computer;
^
src/main.cpp:9:13: error: ‘computer’ was not declared in this scope
cout << computer.divide();
^~~~~~~~
Makefile:17: recipe for target 'objects/main.o' failed
make: *** [objects/main.o] Error 1
Tried a few things and googled the hell out of it, but for some reason I'm not getting it to compile.
Can anyone assist?