I am trying to compile a single .cpp file separately from the build process.
If I do a full build then the compile step outputs to the directory configured when creating the project.
However if I just ask for a compile I end up with the object file going to the same directory as the source, and even worse it goes on and links the object file to the executable when it is supposedly doing a compile.
Note I am compiling with clang++ for C++11, but I don't think that has any barring on why it is calling Clang++.exe a second time for linking which has not been requested.
Edit1
When building it does this
-------------- Build: Debug in GOTW (compiler: GNU GCC Compiler)---------------
clang++.exe -Wall -fexceptions -g -std=c++11 -stdlib=libstdc++ -c
C:\Work\test\2010\C++11\CLang\GOTW\gotw.cpp -o obj\Debug\GOTW.o
clang++.exe -o bin\Debug\GOTW.exe obj\Debug\GOTW.o
Output size is 203.50 KB
Process terminated with status 0 (0 minutes, 11 seconds)
0 errors, 6 warnings (0 minutes, 11 seconds)
Yet when Compile Current File
is performed it does this:
clang++.exe -std=c++11 -stdlib=libstdc++ -c GOTW.cpp -o GOTW.o
1 warning generated.
clang++.exe -o GOTW.exe GOTW.o
I don't understand why it is outputting the second step, and also how to get it to use the obj and bin directories like the build does
Use the -c
option.
-c
Run all of the above, plus the assembler, generating a target ".o" object file.
g++ -c *.cpp it compiles .cpp into .o
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With