Build problem?

Dirk Hohndel dirk at hohndel.org
Mon Apr 8 13:39:40 PDT 2013


Amit Chaudhuri <amit.k.chaudhuri at gmail.com> writes:

> I'm not 100% who did the Qt Makefile work....Alberto I think....?

He started and I did some more work on them. And writing Makefiles is
not my strongest skill (to be nice about it).

> But I'm not convinced the dependency stuff is working 100% correctly.  If I
> try and add a private slots section to the mainwindow.h/.cpp (prelude to
> connecting up the QActions to some new slots), the build tries to compile
> the .cpp before it has run MOC over the header to generate the .moc file.
> This after 'make clean'
>
> This then fails with a message like this:
>
> mit at linux-erag:~/subsurface> make
> updating version.h to 3.0.2-99-g48db782b6719
>     CC main.c
>     CC dive.c
>     CC time.c
>     CC profile.c
>     CC info.c
>     CC equipment.c
>     CC divelist.c
>     CC divelist-gtk.c
>     CC deco.c
>     CC planner.c
>     CC planner-gtk.c
>     CC parse-xml.c
>     CC save-xml.c
>     CC libdivecomputer.c
>     CC print.c
>     CC uemis.c
>     CC uemis-downloader.c
>     CXX qt-gui.cpp
> In file included from qt-gui.cpp:27:0:
> qt-ui/mainwindow.h:23:8: error: expected ‘:’ before ‘slots’
> qt-ui/mainwindow.h:23:8: error: ‘slots’ does not name a type
> make: *** [qt-gui.o] Error 1
> amit at linux-erag:~/subsurface>
>
> Somehow I think the rules need to ensure that the mainwindow moc-ing
> happens before the attempt to include in qt-gui...

Yes, definitely.

I'll ask that someone with better Makefile skills takes a look...

%.moc: %.cpp
	@echo '    MOC' $<
	@$(MOC) -i $(MOCFLAGS) $< -o $@

this seems to imply that the .moc file depends on the .cpp - so why
isn't it being rebuilt?
What happens if you move the section above before this section in the
Makefile (as there are ordering issues with Makefiles)?

%.o: %.cpp
	@echo '    CXX' $<
	@mkdir -p .dep .dep/qt-ui
	@$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<


/D


More information about the subsurface mailing list