0

So I am currently trying to set up my gedit interface and get a very simple code (a "print Hello world!" program) to compile.

Using the one that available on the pset 1, and following the instructions I end up with this...

enter image description here

I don't think there's any syntax mistakes, so I am pretty confused. Anybody thinks they can help?

Thanks!

1

It's not an error message, it's the command that it's executed by make. make is not a compiler by itself, but it calls a compiler, and passes all the relative flags you are probably going to need, so that you don't have to specify it yourself every time you want to compile your code.

A little more detail:

clang -ggdb3 -O0 -std=c99 -Wall -Werror hello.c -lcs50 -lm -o hello
  • clang is the name of the compiler we use
  • -ggdb3 is a flag, that tells the compiler to prepare the outfile for possible debugging later, using gdb v3 (you will learn more about debugging later on course).
  • -O0 tells the compiler not to make any optimization to the code automatically.
  • -std=c99 tells the compiler which standard of C we are writing in.
  • -Wall tells the compiler to give you a warning for all possible syntax errors you have in your code.
  • -Werror tells the compiler to treat every warning as error. (warnings are a little lower level errors, that make your code possible to compile, but will most probably cause errors at runtime).
  • hello.c is obviously the name of your file.
  • -lcs50 is the flag to link the CS50 library.
  • -lm is the flag to link the math library.
  • -o hello is the flag that specifies what name should your compiled code have.

You can read more about clang flags here (http://clang.llvm.org/docs/UsersManual.html#command-line-options) although I think the above are the only flags you are gonna need for this course!

Great job on your first program not having any errors! Now you just have to execute it by

./hello

If this answers your question please accept it by clicking the gray check-mark to the left, so that it becomes green. You can also vote it up by pressing the up arrow above the check-mark. And don't forget to keep coding!!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .