Cannot run C codes on vscode - c

I have installed VScode and gitbash this afternoon on my Windows to pull and push C scripts for a project.
Everything is working fine but i can't run my scripts on the GitBash shell (error is : ..../main.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory)
neither on the PowerShell (compiling but returning nothing when I try to execute the exe file).
If i open a CMD window it's working fine.
I installed the 'code runner' extension to execute the code in one click, but i always get this error :
[Done] exited with code=3221225781 in 0.43 seconds
I already tried to execute the command line that the extension uses :
cd "c:\Users\....\" && gcc main.c -o main && "c:\....\"main
on an external cmd window and it's working fine
I also have MinGW in PATH.
Thank you

I fixed it by downloading "msvcr71.dll" and putting it into C:\Windows\SysWOW64 and C:\Windows\System32

Related

gcc is not recognized as a command in the vscode terminal

When I try to run some very basic code(literally 5 lines) I get the error: "'gcc' is not recognized as an internal or external command,
operable program or batch file." mingw is installed and added to path and when I type gcc --version in cmd everything is fine. I'm using the VSCode editor and I'm running Windows 10.
Try to restart VSCode. I know that if you add/remove anything from PATH and VSCode was already running, you need to re-launch it for any PATH changes to work.

Why cant i compile c in vs code?

I have already install Mingw and do as the guide say. It can run the c program from cmd and works very well but when i open it from the vs code it doesn't work. When i tried to run it in vs code it always show this :
C:\Users\ASUS>cd "e:\TEST\" && gcc max.c -o max && "e:\TEST\"max
gcc: error: max.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
Is there any solution to this problem ?
I have the same problem when I started using visual studio code. The reason is that the default shell in visual studio code is powershell, which doesn't check the current directory. To change the default shell to command prompt, follow these steps.
Open vscode and enter the shortcut ctrl + `. After that you shall be seeing a windows like this.
After that click on the drop down menu on right side of the prompt and then click on select default shell.
Here you should select command prompt, and after selecting it restart your IDE.

Compiling using eclipsec.exe fails but using the IDE it pass

I'm trying to create a CI process to a c code,
The developers are working on an IDE called "Kinetis" and when I ran and compiled the project from the IDE everything is working fine.
To create the CI I tried to compile the project using eclipsec.exe and then I get an error:
c:\jenkins\workspace\embeded_build\ng_brg_plt_env\mqx\source\io\flash_spi\flash_spi.h:19:20: fatal error: device.h: No such file or directory
#include <device.h>
The device.h file exists in :
C:\jenkins\workspace\Embeded_Build\NG_BRG_PLT_ENV\config\twrk65f180m\device.h
Is there something missing in the command line? I couldn't find an argument to pass the classpath, and I don't even know if this will help.
https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html
This is the command I am running:
eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import .\ -build mqtt -cleanBuild mqtt

lld-link.exe: error: failed to open a.exe: permission denied on windows 10

i'm using lld-link to create a .exe file from a obj file but this happen:
I already searched for this error, the common answer was that a.exe was executed and that I have to close it , but I already search for it in the process explorer and there is no a.exe running. I also read that my anti-malware could be the problem so I turned it off but that didn't work as well.
You're trying to write a.exe into C:\Program Files\LLVM\bin. Either cd to your code directory before linking, or specify an absolute path for a.exe to be saved to in the -out:a.exe part of the command.

Simple way to execute C program without IDE

I am new to C. What is the most simple way to execute a C program without an IDE?
I created my first C program und it runs flawlessly using my IDE Netbeans on Mac OS X. Now I need to make that program be "executable without IDE on Windows".
Also the requirement is only "Windows", no specific version. Which means I might have to support XP, Vista, 7, 8.
What is the most simple way to do so?
As soon as you have built your app, it is a program you can run outside the IDE. You just need to find it. :) In NetBeans this will usually be under your project directory in a subdirectory called "dist". There will be an executable file in there which you can copy out to wherever you want.
Download MinGW here: http://sourceforge.net/projects/mingw/files/latest/download?source=files
and install it.
Then go to cmd (In Windows 8 - Windows key+R and type cmd in the window opened. In Windows 7 - search >> run >> cmd).
After installing it and entering cmd type in the Command Prompt window (CMD) cd C:/MinGW/bin (when MinGW is on C drive which is the default path). After doing so type the following command: gcc -o X.exe Y.c when X is the name of the output file (what name you want the .exe file to be and Y is the name of the C file that must be inside of the BIN folder (C:/MinGW/bin by default). It should be compiled smoothly if it compiled in your IDE and then the .exe file would be in the BIN folder named X.exe (when X is what you typed in the CMD). Afterwards, you can close your CMD and do with the .exe file whatever you like.

Resources