I recently migrated my old Cloud9 IDE over to the new AWS format per instructions and all of my files appeared in the new environment. I had only just completed lecture 1 and was starting to make the example programs hello.c and hello2.c from the short videos in the 2018 course. hello.c still compiles. However , when I try to compile hello2.c, I receive an error regarding the line that contains get_string();.

Here is hello2.c:

#include <stdio.h>
#include <cs50.h>
int main(void)
     printf("Enter your name: ");
     string name = get_string();
     printf("hello, %s!\n", name);

Here is the file within my workspace directory:

~/workspace/ $ ls -l total 4 -rw------- 1 ubuntu ubuntu 185 Nov 23 04:38 hello2.c

And here is the error:

~/workspace/ $ make hello2 clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow hello2.c -lcrypt -lcs50 -lm -o hello2

hello2.c:7:13: error: expected expression name = get_string(); ^ /usr/include/cs50.h:109:53: note: expanded from macro 'get_string' #define get_string(...) get_string(NULL, __VA_ARGS__) ^ 1 error generated. : recipe for target 'hello2' failed make: *** [hello2] Error 1

1 Answer 1


The function signature has changed. From the CS50 Programmer's Manual

char *get_string (const char *format, ...);


Prompts user for a line of text from standard input and returns it as a string (char *), sans trailing line ending. Supports CR (\r), LF (\n), and CRLF (\r\n) as line endings. Stores string on heap, but library’s destructor frees memory on program’s exit.

It takes a string argument which is the user prompt (and makes the previous printf line unnecessary).

  • This explains the issue, since I was following a video on IDE from the 2018 course. Is there an updated video on using the IDE in the 2019 version? Why does the function now require a value provided? Just curious because it would seem to me you’d want to instead expand it by making it optional instead of required to provide the prompt within the argument, but also maintain the ability to implement it in the way above for backwards compatibility with the 2018 IDE and existing code, thus avoiding questions like this in the first place. Was this considered prior to making the signature change?
    – Dan
    Nov 23, 2019 at 14:05
  • The IDE is built for the edx 2019 content. (It will be updated in January to the 2020 content). You can find the current courseware at [cs50.edx.org]; you do not have to buy a verified certificate; you can audit the course (I don't remember specifically where that option is). Nov 23, 2019 at 21:08
  • Ok, thanks for letting me know. I am doing audit only. I still don’t understand why the function would not simply be back compatible.
    – Dan
    Nov 25, 2019 at 1:17

You must log in to answer this question.

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