Completely new to programming and will start a mechanical engineering course this year and we have to set up a C enviroment with Visual Studio Code at home.
Was following the instructions so i downloaded and installed MinGW and set the path in Windows. Tested this with the cmd console. Then installed VSC and C/C++ extension and i was supposed to test it with the "Hello World!" program but i get an error message every time:
launch: program 'D:\folder\build\Debug\outDebug' does not exist
Was searching and found that it had something to do with the launch.json config file so i have rewritten it with the suggested ${workspaceFolder} instead of the \ pathing but i get the same error.
Related
I have a problem which is: VSC can't compile my C code as the title said. I have looked for the problems and did all what was necessary:
installed msys
installed mingw
installed C/C++ extensions
added code runner
Yet the problem is still showing like this:
gcc.exe: error: name.c: No such file or directory
(Note that I'm an absolute beginner when it comes to using VSC and don't have any background in coding so I'd appreciate it if I get to know the solution by simple vocabulary :) )
It seems like your c file('name.c') is not located in your working directory.
Moving your c file to your project folder may solve your problem.
To check your working directory, choose terminal tab and type 'pwd'.
I've just downloaded VS Code, and am struggling to work out the basics of running any programs. I'm attempting to run a basic Hello World program in C:
#include<stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
I found out that I needed to download a C compiler to run C programs on VS-Code, so I downloaded Visual Studio with C++ from the Microsoft website, which basically installed Visual Studio 2019. The heading on the link said "Develop C and C++ applications", so I figured it would at least let me program in C.
After doing this, in VS-Code I downloaded the C/C++ extension from Microsoft, and the Code Runner extension by Jun Han, which was recommended by a YouTube video. I then selected the Run Code (...environment? application?), and pressed the Play button on the top-right. The output in the terminal was:
[Running] cd "c:\Users\Leo\Documents\VSC Test Project\" && gcc test.c -o test && "c:\Users\Leo\Documents\VSC Test Project\"test
'gcc' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 0.078 seconds
I don't understand the error - so I opened Visual Studio 2019 to see if I could develop C applications in that. But no, only C++. Did Microsoft lie to me, or is there something else I need to do to configure C in VS2019?
Basically, I have no idea what I'm doing in VS-Code, and would really appreciate someone taking the time to break down how to actually run a program in there, and get C working. Or if there's a simple solution that allows me to write C in VS-2019, that would be equally great.
I just wrote a basic c program to run but compiler prompts the error (see attached image). I have installed Dev-C++ before where I did C++ Programming. But when I wrote C code it prompts error I have deleted it & reinstalled the Dev-C++ again but couldn't run please help.
IDE Version: 5.11
You must choose the right Project configuration (C project):
Remarque : you must have a project path without space. Exemple : C:\Ali\untiled\untiled.c
I installed MinGW compiler to run a C/C++ program. When I check the compiler version it shows this:
This is my MinGW directory:
This is my PATH setting:
I have set my PATH environment variable as follows:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\MinGW\bin;C:\MinGW\MSYS\1.0\bin;
Whenever I run my C/C++ project in Netbeans, it's giving me below error even though my program build is getting successful:
Please help me to fix this issue.
I have visual studio 2012 ultimate and mingw installed on my pc.
However, when I try to compile any program (I have only tried a simple hello world program)
e.g when I use the visual studio cl compiler or the gcc compiler I get the error :
cl is not recognized as an internal or external command, operable program or batch file.
and similar for mingw-gcc.
I have visual studio installed in the default location. I have installed mingw in D:\MinGw but I have added it to the path variable. Also I have installed CodeBlocks after getting frustrated with this and my program builds and runs easily when I try that from inside CodeBlocks. I can also compile my program from inside Visual Studio by clicking on the build and run buttons.
What do I need to do to compile and run programs from the commandline in windows 7?
Instead of running a "regular" command prompt, run the "Visual Studio command prompt". You can find a link to it in the start menu.
It's essentially the same, but it sets up for you all the environment variables you need for all the VS tools to work from the command line.
Sounds like you still have a path problem. The mingw-gcc path for example would need to be to the bin directory:
D:\MinGW\bin
in your case. Then you should be able to run gcc.