While combining boost, a demo project and another library I ran into problems with my definitions.
Having one X.cpp file, including a class X, I need to use this class for a variable in a Y.cpp, to convert a void pointer as a pointer to this class.
In Code:
X.cpp
#include <boost/...>
class x {
}
Main(){
x c(...);
handler = init(&c);
anotherLib-Function(void *handler);
//will call function in Y.cpp with c as void pointer
}
Y.cpp
#include ?!!
yfunction(void *c){
x *cHandle;
*cHandle = (x *)c;
(*cHandle).write("texte");
}
This is how it worked last time – kind of. I would very much appreciate a solid solution for this messy contruct or anything making this code better/working. Thanks!
Split the X file in a header file (X.h) containing class declaration and a source file (X.cpp) containing definitions for the class constructors, methods etc.
Now include the header file in the Y.cpp file of yours. Then compile somehow like this: