Score:0

How do you compile c files with clang into a binary format?

eh flag

I created source code as a .c file and tried running clang exampledebugging.c into it.

It came up empty.

Can anyone please help me? I am trying to compile this program into a binary executable format.

hr flag
What do you mean by "came up empty"? Generally, Linux commands aren't needlessly verbose. Is there now a file named `a.out` in your current directory?
Akbar Ali avatar
eh flag
Ah. Yes. I see it now.
Akbar Ali avatar
eh flag
I guess I didn't need any help after all. Whoopsie :)
hr flag
If you want the binary executable to have a different name, you can specify that using `-o` ex. `clang exampledebugging.c -o exampledebugging`. Same thing with `gcc`/`g++`
Akbar Ali avatar
eh flag
I cannot thank for your help. But I ran into one small problem. My gdb debugger won't open :/
hr flag
That sounds like it should be a separate question
Akbar Ali avatar
eh flag
I downloaded it from terminal. It said that it has been installed, but I can't find it anywhere
Akbar Ali avatar
eh flag
Never mind I just figure it out haha :)
Score:2
hr flag

Generally, Linux commands aren't needlessly verbose - clang doesn't necessarily output anything to the terminal if the command succeeds. In the case of

clang exampledebugging.c

it should simply have created a binary executable with the default name a.out that you can execute using ./a.out. If you want the output file to be named differently, use the -o option:

clang exampledebugging.c -o exampledebugging

The GNU compilers gcc and g++ behave the same.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.