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