1

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.

3
  • I think you should ask this question on Stack Overflow. Commented Jan 29, 2013 at 10:03
  • Is is one of the other group..?? Commented Jan 29, 2013 at 10:10
  • Yes. Just enter here: stackoverflow.com and login. Commented Jan 29, 2013 at 10:26

1 Answer 1

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 :)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.