0

I want to create a binary file from a C file using ubuntu. I have done something like:

gcc -c ArrayError3.c -o ArrayError3. 

This creates a file ArrayError3 on my Desktop. When I click on it, ubuntu tells me that there is no application installed for object files. I am very much a newbie to C and linux. Could anyone please advise me on how to solve this issue? Many thanks.

3 Answers 3

1

Just drop the -c so it won't stop after making the object file. The -c option tells gcc not to run the linker. If omit it, gcc will make a full blown executable for you.

Sign up to request clarification or add additional context in comments.

2 Comments

Does this make a static or dynamic binary? The reason I ask is because I was told by an academic at my university to run zzuf(an application input fuzzer) on this binary. I happen to know that zzuf does not work on static binaries. A further problem is that zzuf is an application input fuzzer(the input by default being a file). The app in question though only takes user input from the console.
@EShindler You should be OK as long as you don't pass any -static arguments.
0

You need to read more about what the arguments for GCC mean. The -c option tells GCC to create an object file, not an executable file. This object file needs to be linked to create an executable file.

This is commonly used when you have several source files that needs to be linked together to form one executable. Example:

$ gcc source1.c -c -o source1.o
$ gcc source2.c -c -o source2.o
$ gcc source1.o source2.o -o exec

The solution for you it to simply not use the -c option.

Comments

0

The problem is in

gcc -c

The -c switch makes GCC not link your code to an actual executable, only compiles it to an object file, which is not a "complete" format, it can't yet be run. Use just

gcc ArrayError3.c -o ArrayError3

instead.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.