I am using the CS50 online IDE and I don't understand why am I getting this error, I followed all instructions. The first hello.c program runs just fine without errors. However when I try to compile string.c I get the following error. And sometimes it's generate a folder with a .c9

chris669d:~/workspace $ ./hello
hello, world
chris669d:~/workspace $ make string
clang -ggdb3 -O0 -std=c11 -Wall -Werror string.c -lcs50 -lm -o string
string.c:6:19: error: implicit declaration of function 'get_string' is invalid in C99
string name = get_string();
string.c:6:19: note: did you mean 'GetString'?
/usr/include/cs50.h:106:8: note: 'GetString' declared here
string GetString(void);
string.c:6:12: error: incompatible integer to pointer conversion initializing 'string' (aka 'char *') with an expression of type 'int' [-Werror,-Wint-conversion]
string name = get_string();
^ ~~~~~~~~~~~~
2 errors generated.
make: *** [string] Error 1
chris669d:~/workspace $

the generated folder and its contents

  • Yes included that as well. I didn't mention that. But I'm still getting the same error – christian Martin Jan 19 '17 at 22:07

What version of the CS50 IDE? You can see it in the top right next to the cloud9 icon, or run version50. Current version is 94 (as of this writing). get_string() was introduced recently, for the CS50x 2017 version. Here's all that's new. Run update50 to ensure you have all the latest.

  • Wrong way round. The new spellings (of which get_string is one) don't work on some older versions of the IDE. – DinoCoderSaurus Jan 19 '17 at 22:37

Put this at the top of your hello.c file:

#include <cs50.h>

string and get_string() are declared in cs50.h.

You must log in to answer this question.

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