Solved cmake project configured incorrectly
-
I'm trying write a QML project with C++ objects exposed in it and I think i've configured my QtCreator wrong because my first use of Q_PROPERTY has a syntax error of "unexpected token '(' " and when I compile, i get "undefined reference to vtable for DbHost" (which is my C++ class name) I think i've configured my project wrong but I don't know how wrong. My project is in my githubrepo
-
When I comment out my type registration it compiles just fine
// qmlRegisterType<DBHost>("io.github.dacresni", 1, 0,"DBHost");
-
and when i comment out both macros i get the error
/usr/include/qt5/QtQml/qqmlprivate.h:99: error: undefined reference to `DBHosts::DBHosts(QObject*)' -
Hi,
You’re not compiling all of your sources.
-
@SGaist how do i change that? Im on linux; Fedora 27 and I have qt installed by both package manager and via the Qt Mantainance tool.
-
It’s not a Qt problem, you don’t list all the sources for your application. You have only put main.cpp.
-
I'm new to QtCreator and I'm not sure the problem is in my Cmake file , my project settings or my build kits.
-
As I already wrote, your CMakeList file is wrong. In add_executable, you are only listing main.cpp. So you are not compiling all your other classes hence the error you are getting.
-
@SGaist said in cmake project configured incorrectly:
add_executable
OH! now i understand. my Cmake file needs hostslist.cpp and hostslist.h
-