Bad output directory in a certain situation
Closed this issue · 1 comments
GoogleCodeExporter commented
________ What steps will reproduce the problem?
Let's say you have the following architecture:
MainApp
|-- Source
| |--- MainSource1.cpp
| |--- MainSource2.cpp
| `--- DependancyFile.cpp
|-- Include
| |--- MainInclude1.h
| `--- MainInclude2.h
`-- SecondaryApp <------------------------- Doing a "make" on this one
|--- SecondaryApp.makefile
|--- Source
| |--- SecondarySource1.cpp
| `--- SecondarySource2.cpp
`--- Include
|--- SecondaryInclude1.h
`--- SecondaryInclude2.h
Now imagine you're building your SecondaryApp and you included the
MainSource1.cpp in your solution because you need it. The MainApp doesn't need
to be built, hence why there isn't any makefile.
When building SecondaryApp, DependancyFile.d and .o won't be placed in the
SecondaryApp/gccDebug directory but in the SecondaryApp/source directory.
________ What is the expected output? What do you see instead?
Have the *.d and *.o files placed in the correct directory (as indicated before)
________ How to fix it?
- Change the Debug/Release Configuration (basically just remove the ../)
- Change the file output and input paths when compiling the file
Example based on my work - Change this:
# Builds the Debug configuration...
.PHONY: Debug
Debug: create_folders ./gccDebug/../source/DependancyFile.o
./gccDebug/source/SecondarySource.o ./gccDebug/source/SecondaryMain.o
g++ ./gccDebug/../source/DependancyFile.o ./gccDebug/source/SecondarySource.o ./gccDebug/source/SecondaryMain.o $(Debug_Library_Path) $(Debug_Libraries) -Wl,-rpath,./ -o ../../serveur/gccruntime/SecondaryApp.exe
# Compiles file ../source/DependancyFile.cpp for the Debug configuration...
-include ./gccDebug/../source/DependancyFile.d
./gccDebug/../source/DependancyFile.o: ../source/DependancyFile.cpp
$(CPP_COMPILER) $(Debug_Preprocessor_Definitions) $(Debug_Compiler_Flags) -c ../source/DependancyFile.cpp $(Debug_Include_Path) -o ./gccDebug/../source/DependancyFile.o
$(CPP_COMPILER) $(Debug_Preprocessor_Definitions) $(Debug_Compiler_Flags) -MM ../source/DependancyFile.cpp $(Debug_Include_Path) > ./gccDebug/../source/DependancyFile.d
!! ------------ BY THIS ------------ !!
# Builds the Debug configuration...
.PHONY: Debug
Debug: create_folders ./gccDebug/source/DependancyFile.o
./gccDebug/source/SecondarySource.o ./gccDebug/source/SecondaryMain.o
g++ ./gccDebug/source/DependancyFile.o ./gccDebug/source/SecondarySource.o ./gccDebug/source/SecondaryMain.o $(Debug_Library_Path) $(Debug_Libraries) -Wl,-rpath,./ -o ../../serveur/gccruntime/SecondaryApp.exe
# Compiles file source/DependancyFile.cpp for the Debug configuration...
-include ./gccDebug/source/DependancyFile.d
./gccDebug/source/DependancyFile.o: ../source/DependancyFile.cpp
$(CPP_COMPILER) $(Debug_Preprocessor_Definitions) $(Debug_Compiler_Flags) -c ../source/DependancyFile.cpp $(Debug_Include_Path) -o ./gccDebug/source/DependancyFile.o
$(CPP_COMPILER) $(Debug_Preprocessor_Definitions) $(Debug_Compiler_Flags) -MM ../source/DependancyFile.cpp $(Debug_Include_Path) > ./gccDebug/source/DependancyFile.d
Original issue reported on code.google.com by florian.sainjeon
on 2 Oct 2013 at 9:07
- Merged into: #25
GoogleCodeExporter commented
Original comment by florian.sainjeon
on 28 Nov 2013 at 8:32
- Changed state: Duplicate
- Added labels: ****
- Removed labels: ****