Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Suppose i have a c++ file, created an object file and c file created another object file. Now i need to link both into one executable. While i'm trying it is giving errors about c++ not found. Can anyone help me about that.

Thanks in advance.

share|improve this question
I think you should ask this question on Stack Overflow. –  Zignd Jan 29 '13 at 10:03
Is is one of the other group..?? –  Kranthi Jan 29 '13 at 10:10
Yes. Just enter here: stackoverflow.com and login. –  Zignd Jan 29 '13 at 10:26

1 Answer 1

If you have two output object files, let's call these files a.o and b.o you can link them into one executable like so:

gcc a.o b.o -o output_executable_name

Obviously, replace 'output_executable_name' with the name of the program you want to build. You will need, by default, to have a 'main' function defined in one of those object files and you need to not have any unresolved dependencies with external libraries.

However, I want to urge you to perhaps investigate going to a C++/C programming forum as AskUbuntu.com is for solving problems/issues with Ubuntu not for learning C/C++ programming.

I have, as a token of goodwill, attempted to answer your question though - good luck with your programming :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.