0

I just began taking the CS50x course, and while tweaking the programs used on the lectures I came accross a very unpleasant obstacle.

I followed the exact same steps and recreated the exact same source code as used on class to make sure there weren't any coding errors, but I still get these annoying messages when trying to compile the code in Cloud 9's CS50 IDE:

Hello.c:5:5: error: use of undeclared identifier 'string'; did you mean 'stdin'? string s = "Hannah"; ^~~~~~ stdin /usr/include/stdio.h:168:25: note: 'stdin' declared here extern struct _IO_FILE stdin; / Standard input stream. */ ^

Hello.c:5:11: error: expected ';' after expression string s = "Hannah"; ^ ;

Hello.c:5:12: error: use of undeclared identifier 's' string s = "Hannah"; ^

Hello.c:6:28: error: use of undeclared identifier 's' printf ("Hello, %s/n", s); ^

Hello.c:5:5: error: expression result unused [-Werror,-Wunused-value] string s = "Hannah"; ^~~~~~ 5 errors generated. make: *** [Hello] Error 1

I printed the screen to better ilustrate what's happening.

thanks in advance for the help.enter image description here

0

string isn't a standard data type, it is a data type that was created for this class in the cs50 library. You need to add the following line to the top of your file.

#include <cs50.h>

This will add the type definition to your program.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

| improve this answer | |

You must log in to answer this question.

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