简体   繁体   中英

Compiling C code in Linux terminal

I am using Linux mint 16. I had a code that I change it a bit. I use two following commands in terminal in order to run the code. The problem is that it does not give me any error but the changes are not applied, which means it runs the previous version of code.

gcc -std=c99 -c Code.c -o Code.o
./Code

gcc -std=c99 -c Code.c -o Code.o will put the compiled object file in Code.o , not ./Code as you expect it to be..

Also, -c tells do not run the linker. So effectively you end up with an object file which cannot be run.

gcc -std=c99 Code.c -o Code will produce what you need.

For a complete list of gcc flags either use man gcc or see http://linux.die.net/man/1/gcc

Try

gcc -std=c99 -c Code.c -o Code
./Code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM