I have 3 files pos.h pos.cpp and main.cpp .... I am trying to call a function from pos.cpp in the main class for instance :
pos.h file
class pos {
public:
pos(); //defualut constructor
int open_port();
}
pos.cpp
#include "pos.h"
int Open_port() {
//do stuff here
return 0;
}
class main.cpp
#include "pos.h"
int main(int argc , char** argv) {
pos pos1;
pos1::Open_port();
}
Problem is I always get that pos1 is not a class or namespace I am compining as follows g++ mainpos.cpp pos.cpp pos.h -o position -lpthread Any thoughts ?