Shortcut to compile a file of any type

T

Torben Laursen

Hi

Often I just want to compile one c++ file in a project the check it for
errors.
Now I can right click on a *.cpp file and select "Compile"
But is there a way and short cut to compile a file of any type. luke *.cc,
*.h, *hpp

Thanks Torben
 
B

Ben Voigt

Torben Laursen said:
Hi

Often I just want to compile one c++ file in a project the check it for
errors.
Now I can right click on a *.cpp file and select "Compile"
But is there a way and short cut to compile a file of any type. luke *.cc,
*.h, *hpp

..cc should work just like .cpp
..h and .hpp aren't complete compilation units, compile some .cpp file that
#include the file you want to test.
 
T

Torben Laursen

Hi Ben

I tryed *.cc But then I get a lot of errors from the linker like "The
function A is defined in both file X and Y"

Torben
 
B

Ben Voigt

Torben Laursen said:
Hi Ben

I tryed *.cc But then I get a lot of errors from the linker like "The
function A is defined in both file X and Y"

Linker? I thought you were just compiling.

What are files X and Y, and where is function A really (in X, in Y, in a
header file, etc.)?
 
T

Torben Laursen

Hi Ben

Well it is nice to be able to both compile and link the project.

This is an example of the error:
Error 16 error LNK2005: _SetMixture@36 already defined in BaseCalc.obj
Dll_SetMixture.obj
Error 9 error LNK2005: _SetMixtureKij@28 already defined in BaseCalc.obj
Dll_SetMixture.obj

basecalc.cpp includes dll_setmixture.cc

If the type of dll_setmixture is changes th "h" it links fine but then I
cannot compile the file alone

Torben
 
B

Ben Voigt

Torben Laursen said:
Hi Ben

Well it is nice to be able to both compile and link the project.

This is an example of the error:
Error 16 error LNK2005: _SetMixture@36 already defined in BaseCalc.obj
Dll_SetMixture.obj
Error 9 error LNK2005: _SetMixtureKij@28 already defined in BaseCalc.obj
Dll_SetMixture.obj

basecalc.cpp includes dll_setmixture.cc

..cc files are standalone, not meant to be #include from other files.

C++ source files are usually .cpp on windows or multi-platform projects, and
..C or .cc on unix. But they are all the same (except .C can't be used on
windows because of case insensitivity).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top