hi im trying to figure out how to make this work
i have main.cpp, asd2.cpp and asd.h
asd.h has the class inside
here is the code
asd2.cpp has some functions from class aCode:class a { int x; public: int getX(); void setX(int); };
and finally here is the mainCode:#include <iostream> #include "asd.h" void a::setX(int b){ x = b; } int a::getX(){ return x; }
im wondering why it doesnt work, it saysCode:#include <iostream> #include "asd.h" using namespace std; int main(void){ a b; b.setX(109); cout<<b.getX(); cin.get(); return 0; }
i think it has something to do with the "include"Code:[Linker error] undefined reference to `a::setX(int)' [Linker error] undefined reference to `a::getX()' ld returned 1 exit status
does anyone know how to fix this problem? thanks in advance



LinkBack URL
About LinkBacks



