Reputation: 754
I'm learning The Model-View-Presenter (MVP) Pattern with Qt and have the follow example. I can build it and run it from build folder, but can't debug it due to the error:
.../glibc-2.19/sysdeps/x86_64/start.S:118: error: undefined reference to `main'
error: collect2: error: ld returned 1 exit status
I can't figure out what's wrong? A quick Google search brings not much information. PS: I use OpenSUSE 13.1 with Qt 4.8
Upvotes: 0
Views: 1700
Reputation: 4286
You are using subdirs
template wrong. It should not contain anything, but SUBDIRS
and sometimes CONFIG += ordered
. Also your project model is a bit complicated. You should try something simplier first, without libraries and subprojects.
Good example of subdirs project: How to use QMake's subdirs template?
Update
I'll explain a bit. Minimal changes you need to do in your project in order it to compile & link:
SOURCES = $$PWD/Presenter/main.cpp
line from WiringClone.pro
CONFIG += ordered
to WiringClone.pro
and View.pro
config \
line from WiringClone.pro
(this is the one that caused the original link error)WiringClone.pro
: Utilities Model View Presenter
, View.pro
: Logic GUI
But, even after all these changes you'll have to solve an unsolvable problem: your Utilities
library depends on your Model
library, but your Model
depends on your Utilities
. Linking doesn't work this way. Cyclical dependencies are not allowed. That's why I recommend you to loose all your libraries and write a simple solid executable first.
Upvotes: 1