im trying to compile two files on my bash : Main.c , DB.c this is how i compiled them and they gave me no errors : gcc -c Main.c DB.c` so they should have created Main.o and DB.o . now im trying to compile Main.o and DB.o : -Wall Main.o DB.o but when im trying to compile these the bash gives me that -Wall: command not found

anyone encountered this issue ?


-Wall isn't a command1, it's an option (show all warnings) to the gcc command. From man gcc

       This enables all the warnings about constructions that some users
       consider questionable, and that are easy to avoid (or modify to
       prevent the warning), even in conjunction with macros.  This also
       enables some language-specific warnings described in C++ Dialect
       Options and Objective-C and Objective-C++ Dialect Options.

To link your object files to produce an executable a.out , you need

gcc Main.o DB.o

or (to give an alternative executable name myprog)

gcc -o myprog  Main.o DB.o

Alternatively, compile and link in a single command (with warnings)

gcc -Wall -o myprog Main.c DB.c

[1]. wall is - but that's something completely unrelated

  • thanks a lot for the answer and the information , it really worked :) – user6748658 Aug 25 '16 at 14:31

Try to build and compile like this:

gcc filename.c -o outputFile_name ./outputFile_name

And do this for the two files separately. The following file should compile with the name "outputFile_name" after it has been followed by -o

  • thank you for helping me , it was really helpful taking me to the solution :) – user6748658 Aug 25 '16 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.