user9143071
user9143071

Reputation: 19

How to run a C program which uses string.h in Ubuntu

My C program uses string.h.. Initially I was not able to compile it. But then I used

$ gcc filename.c -E

Then it complied but I am not able to run it with both

./a.out 
./filename

Upvotes: 0

Views: 2467

Answers (1)

dbush
dbush

Reputation: 225362

The -E option to gcc invokes only the preprocessor. If you want to compile you need to do this:

gcc -g -Wall -Wextra -o filename filename.c

The -o option specifies the name of the executable to create, the -W options enable the common compiler warnings, and -g includes debugging symbols so you can use tools such as gdb to step through the code line by line.

Upvotes: 2

Related Questions