This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What is translation unit


Hello,

Sorry, I did not fully understand. I think mean that number of translation
units = number of cpp files.
Right?


John (Eljay) Love-Jensen wrote:
> 
> Hi mahmoodn,
> 
>> What is translation unit and how can I determine how many translation
>> unit
>> my code have? :confused:
> 
> Let's say you have three source code files, foo.cpp, bar.cpp and baz.cpp.
> 
> Here are the three translation units, which translate from the source file
> to the object file.
> 
> g++ -c foo.cpp -o foo.o
> g++ -c bar.cpp -o bar.o
> g++ -c baz.cpp -o baz.o
> 
> 
> When linking the object files together, that process is not a translation
> unit.
> 
> g++ foo.o bar.o baz.o -o quux
> 
> HTH,
> --Eljay
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/What-is-translation-unit-tp14250608p14252082.html
Sent from the gcc - Help mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]