The definition is:Originally Posted by manasij7479
Originally Posted by C++03 Clause 2 Paragraph 1 (part)
This is a discussion on Having trouble with llinker and Undefined reference errors within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by manasij7479 What is a translation unit ? The definition is: Originally Posted by C++03 Clause 2 Paragraph ...
OK.. Suggest me something...
I have multiple independent (*.h + *.cpp) pairs ...They are translation units if I understand the definition.
All of them need to be combined into a single project..
Till now ..I've been # including the headers in the main program...and then giving the compiler the *.cpp files together..
Is there a better way to work with such distinct units ?
That's a normal way of working: you have separate source files and include headers where you need them, then finally link the object files generated to form the final product.Originally Posted by manasij7479
Normally, all you do is add all the .cpp files to the project list of source files.
The IDE generates a 'makefile' from this, and then make works out the minimum dependencies necessary to keep the executable up to date.
Done well, if you edit only one source file, you only compile that source file and then run the linker to combine all the objects and libraries together.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
What is the difference between an IDE generated makefile and a manually made one ?...Is there some tech *magic* (!) involved so that the former one works better ?