I'm trying to learn C programming and have been using an online tool successfully. After finishing my programs, I copy them into Visual Studio Code (VSCode) for record-keeping. However, I'm having a tough time getting things to compile correctly. I followed a tutorial to set up my environment, including ensuring the right paths and installing necessary extensions, but now nothing seems to work. My GCC compiler isn't producing executables in my PowerShell, though it did when I tried the MSYS2 terminal. I've also done a fresh install to troubleshoot. It's frustrating because I just want to learn C, and this issue with VSCode is driving me up the wall! Any advice would be greatly appreciated!
1 Answer
You don’t need to rely solely on Visual Studio to compile your code on Windows. With GCC already installed, you can simply use the Command Prompt. Just follow these steps:
1. Open Command Prompt by running `cmd.exe`.
2. Check if GCC is accessible in your PATH with `gcc.exe --version`.
3. Navigate to your project folder with `cd "c:UsersJasonDesktopLearning C"`.
4. Compile your code by running `gcc.exe -o anagrams.exe anagrams.c` (be sure to include the .exe extension for Windows).
5. Finally, check if the executable was created by running `dir anagrams.exe`. After that, you can run it and see the output directly from this environment.
I understand what you're saying, but I just want my VSCode to work like the tutorial. When I run my code, it doesn't show any output—just errors, even with a simple helloWorld program. It seems like VSCode isn't executing or testing any of my code. It's just not behaving right. Do you think I should accept that it might not work well for me?