Unsolved Build error while importing a simple project from a makefile
-
I've looked up on the forum before posting this question, but couldn't find any hints.
Here is the structure of the makefile
BASIC = common/code1.o common/code2.o common/code3.o common/code4.o OBJECTS = \ main_code_1 \ main_code_2 all: ${BASIC} $(OBJECTS) values ${BASIC}: common/code1.hh common/code3.hh common/code4.hh common/different_code.cpp $(OBJECTS): ${BASIC} values: cd get_values; $(MAKE) $(MFLAGS) main_code_2: ${BASIC} additional_code.o clean: rm -f *.o ${BASIC} $(OBJECTS) get_values/get_values dist-clean: clean
The directory tree is the following:
├── common │ ├── code1.cpp │ ├── code1.hh │ ├── code2.cpp │ ├── code2.hpp │ ├── different_code.cpp │ ├── code3.cpp │ ├── code3.hh │ ├── code4.cpp │ └── code4.hh ├── get_values │ ├── datab.cpp │ ├── datab.h │ └── reader.cpp ├── additional_code.cpp ├── additional_code.hpp ├── main_code_1.cpp ├── main_code_2.cpp
How to specify the sources for each specific targets in the .pro file?
I tried to put everything in theSOURCES
andHEADERS
variable but it doesn't work like the make file dependencies.Thanks in advance.
K -
Hi @kevinmeal
- how does your
*.pro
file looks now? - which error do you get exactly?
- if you want to generate separate targest, you should probably use qmakes
SUBIDR
template to create your project structure: https://wiki.qt.io/SUBDIRS_-_handling_dependencies
Regards
- how does your
-
I solved it temporarily by compiling the object files for the subdirectories (using make directly in the shell) then linking them as libraries in the .pro file.
Then I addedmain_code.cpp
asSOURCES
.