0

I'm on the first CS50 lecture and I'm entering the code into VS Code exactly how I thought it was supposed to be, but for some reason I keep getting the errors at the bottom. It keeps telling me when I try to run make helloweb that the make function doesn't exist

Here's the code.

    #include <cs50.h>
    #include <stdio.h>
    
    int main(void)
    {
        string answer = get_string("What's your name? ");
        printf("Hello, answer\n");
    }

enter image description here

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • 2
    Your Terminal window is currently using PowerShell, while the CS50 example shows them using what looks like `bash`. The error you're getting is because `make` is an executable command which won't work in PowerShell without [awkwardly whispering softly into PowerShell's ear until it calms down](https://stackoverflow.com/questions/4639894/) - or you could ensure your git-for-Windows install includes bash and then configure VSC to use bash instead of PowerShell: https://stackoverflow.com/questions/42606837 – Dai Jun 09 '22 at 01:46
  • 1
    Does this answer your question? [How do I use Bash on Windows from the Visual Studio Code integrated terminal?](https://stackoverflow.com/questions/42606837/how-do-i-use-bash-on-windows-from-the-visual-studio-code-integrated-terminal) – Karl Knechtel Jun 09 '22 at 02:29

1 Answers1

1

I fixed this issue by running cs50 through Codespaces.

Go to https://code.cs50.io/ and log in with GitHub. After that, you should be able to run Codespaces through VS Code natively by installing the codespaces extension for VS Code. Finally, launch https://code.cs50.io/ through a browser and click "Open in VS Code Desktop".

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
  • 1
    Please keep in mind that this is *not a discussion forum*. Answers should be written like they are part of a repository of knowledge (because they **are**), not as if you were talking to a classmate. – Karl Knechtel Jun 09 '22 at 02:31
  • @KarlKnechtel but if their goal is to enrich the tag of https://stackoverflow.com/questions/tagged/cs50 I don't think that's forbidden. – Lex Li Jun 09 '22 at 04:43
  • @KarlKnechtel If StackOverflow is being held-up as an example of "a repository of human knowledge" as though it's analogous to the Protoss Archive or Asimov's _Foundation_ then I must say that's a peculiar set of standards you hold communities to... I'll shitpost and converse casually if I want to :) – Dai Jun 09 '22 at 08:02
  • (Now for an on-topic reply): While this answer's solution of "just use Codespaces" will work (and codespaces probably are the best way to ensure _the initiates_ all have a consistent and predictable environment), it doesn't help with cases where people can't use codespaces - so yes: use codespaces if you can, but if you can't: don't worryh because you still can complete CS50 using your "real" environment, you just need to edit your VS Code settings to use bash instead of PS. – Dai Jun 09 '22 at 08:05