I know this is a stupid question, and I'm 99% sure it has something to do with the way I'm compiling, but I seriously have no idea what I'm doing wrong.
Whenever I try to compile I get stuff like this:
undefined reference to `Test::Test()'
//Test.hpp
#ifndef Test_hpp
#define Test_hpp
class Test {
public:
Test();
Test(int a);
int get();
void set(int a);
private:
int myVal;
};
#endif /* Test_hpp */
//Test.cpp
#include "Test.hpp"
Test::Test(){}
Test::Test(int a){
this->myVal=a;
}
int Test::get(){
return this->myVal;
}
int Test::set(int a){
this->myVal=a;
}
//main.cpp
#include <iostream>
#include "Test.hpp"
int main() {
Test t;
t.set(15);
std::cout<<t.get()<<"\n";
t=Test(69);
std::cout<<t.get()<<"\n";
return 0;
}