Hi ppl,
have a relatively straightforward problem, but can't seem to figure out what's happening here.
I've created a shared library with Qt. It compiles fine, and is installed. I try to instantiate an object from one of the defined classes in main.cpp of a program using the library.
#include <myClass.h>
int main(int argc, char *argv[])
{
ManiDialog *w = new ManiDialog( 0 );
MyClass *m = new MyClass();
w->show();
return a.exec();
}
#include <myClass.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ManiDialog *w = new ManiDialog( 0 );
MyClass *m = new MyClass();
w->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
The library is added to the .pro file, the include path is set. I've used the Q_DECL_EXPORT macro in the library (QtCreator created this automatically for me). I don't know if that is important to this. MyClass is a concrete class, whose abstract base class is also defined in the library.
class MyClass LIBMYCLASS_EXPORT : public MyOtherClass
class MyClass LIBMYCLASS_EXPORT : public MyOtherClass
To copy to clipboard, switch view to plain text mode
I get the following error when running "Build" in QtCreator:
main.cpp:10: error: ‘m’ was not declared in this scope
main.cpp:10: error: expected type-specifier before ‘MyClass’
main.cpp:10: error: expected ‘;’ before ‘MyClass’
make: *** [main.o] Error 1
main.cpp:10: error: ‘m’ was not declared in this scope
main.cpp:10: error: expected type-specifier before ‘MyClass’
main.cpp:10: error: expected ‘;’ before ‘MyClass’
make: *** [main.o] Error 1
To copy to clipboard, switch view to plain text mode
Can anyone help me out? This seems so straightforward...
Thanks,
Stephan
Bookmarks