Cant compile or "make" code


Hey Guys, i just started CS50’s coarse, I’m currently in week 1 of the module, and I’m having an error of not being able to compile or make my code. Ive looked at the other trobleshooting solutions, but nothing has worked.

I’ve made sure that I am in the right directory (using cd ~/workspace/pset1) and i have tried many variations of the file name to see if it would make or clang. In responding to the answer, please note that i am extremely new and the “less comfortable” type in this coarse.

Also, if somebody knows why my code on the top won’t highlight familiar code( like #include <stdio.h>) in different colors, i would like to fix that too.


To get started let’s rename that file to hello.cpp and the the following command to compile it.
g++ hello.cpp

That will produce an executable called a.out, and we run it with ./a.out

Also read this short article on makefiles


To follow up with @vasilenko93’s comments, please note the following:

  • C++ files should have the extension .cpp. Without that, the IDE doesn’t know if the code is C++, so no syntax highlighting by default
  • The make command needs a file called makefile by default. Only use the make command after you know how to write a makefile
  • For single .cpp or .c files, Cloud9 knows how to build and run them. To use that feature, open the .cpp file you want to run, and click on ‘Run’ near the top of the IDE


you mean g++ hello.txt


you have to save the file as hello.c in order to make and ./hello.c!
easy way to make new files directly in bash is to write “touch hello.c” for example, you can the drag and drop it into the appropiate pset-folder!
cs50 course uses c, so the file ending is .c! i’m doing the same course :wink:


Hi There,

I am doing the same course online and couldn’t get pass “hello world”
Tried everything but its not compiling…could you please help ?

Good to find more people for CS50, do we have any designated forum for that ?


from your screenshot it looks like hello.c is not saved (see the dot on the tab)
Run cat hello.c in the terminal to check that
Once saved make hello should work


Thanks. You are right.
It says command not found on running- cat hello.c

I changed the UI settings, so can also see the * for changed files now. But the problem is - its not saving. There is no file>save option and command S is not working. Is that a problem running it on cloud9 ?

Sorry - I am kind of technically challenged at this stage :slight_smile:


that’s strange, it should look like

Which browser do you use? are there any error messages shown in the browser devtools?

Try opening the ide in another browser?


Thanks, I am using chrome. I was not getting these option, but logging in again did the trick.


have you found a solution for this problem?
i am experiencing the same problem.
help me.