0

I'm a complete beginner who just commenced on the CS50 course through EDX. While tryin out the walkthrough lessons in the CS50 IDE (clou9), I'm getting the following warning

"TEST.C: In function ‘int main()’:
TEST.C:6:19: warning: deprecated conversion from string constant to ‘string {aka char*}’ [-Wwrite-strings]
     string name = "David";"

The script is exactly the same as shown in the walkthrough section video but still getting this warning. For ready reference, code pasted below. I feel it mustbe some setting in the IDE since no error comes up while David runs this code in the video. Pls help.

The script given below for ready reference.

#include <cs50.h>
#include <stdio.h>

int main(void)
{
    string name = "David";
    printf("hello, %s\n", name);
}
1
0

You need to be sure to save your source code before running make. I can see that you haven't, because the error message says "In function 'int main()' but your sample code says int main(void).

The code the compiler is using was probably saved before you added the cs50 library header as well, which is why you are seeing that error.

After saving the file, run make again and it should work. If it still doesn't, be sure you have run update50, then closed and reopened your terminal tab.

You must log in to answer this question.

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