02-20-2013 06:26 PM
I am trying to make a shared library. I used the Blackberry Project -> Shared Library and went for the Makefile option. The source files and header files are being compiled and included. The hard part is getting the moc to work.
Here is my Makefile:
LIST=CPU ifndef QRECURSE QRECURSE=recurse.mk ifdef QCONFIG QRDIR=$(dir $(QCONFIG)) endif endif include $(QRDIR)$(QRECURSE) MOC := /Applications/bbndk/host_10_0_9_534/darwin/x86/usr/bin/moc SRC+=moc_file.cpp moc_%.cpp: %.h $(MOC) $(DEFINES) $(INCVPATH) $< -o $@
The project contains a src directory and a public directory. The src directory contains headers and source files and the public directory contains public headers. I have modified the common.mk to include these in the EXTRA_SRCVPATH.
My basic assumption is that when make goes looking for moc_file.cpp it would read the rules and realise moc_file.cpp can be created from file.h with the moc command, but this cannot be the case as I continuously get the error No rule to make target `moc_file.o', needed by libry.a. So how does it really work and how can I fix this?
02-21-2013 04:18 PM
do you have moc_file.cpp successfully created by moc based on file.h?
It seems in your case make can't find a rule to create moc_file.o file based on your moc_file.cpp
02-21-2013 04:51 PM
02-21-2013 04:56 PM
That's the problem. I am afraid 'Shared library' type of project is not considered by NDK as 'Cascades-like' project so new project does not know that it needs to run moc on .h files containing Q_OBJECT. I'd look on how ordinary Cascades project handles this and added the same to your makefiles.
02-21-2013 05:02 PM
That's what I would hope to do by adding this
SRC+=moc_file.cpp moc_%.cpp: %.h $(MOC) $(DEFINES) $(INCVPATH) $< -o $@
by adding the moc_file.cpp to the SRC macro, I'd hope that make would see this file does not exist and call the rule, but it doesn't. Then there is this rule
MOC_MODULES := $(patsubst %.h, moc_%, $(shell grep -l Q_OBJECT *.h))
that could be used to find the files that do contain Q_OBJECT but sadly *.h always thorws up an error saying that
grep: *.h: No such file or directory.
02-21-2013 05:48 PM
02-22-2013 08:41 AM
So, fixed?
03-10-2013 12:42 AM
Anybody knows how to run moc if using CDT internal builder in project?