I am trying to write a simple program that would parse some string and pass it to bash on Windows 10 (with the not-so-new Linux subsystem). So I try
system("bash");
(in the actual program I include some arguments for bash, but it behaves the same with or without them)
I get this error when the program launches:
'bash' is not recognized as an internal or external command, operable program or batch file.
I found this error is often caused by unset path variable, but it seems to be fine when I checked and I can launch bash from the command line without problem. I am using Visual Studio Express for desktop.
Update: calling dir C:\Windows\System32 from cmd gives 4142 results, while running system("dir C:\\Windows\\System32"); code in c gives 2839. Apparently it is not just bash the program can't see. Why is it so? Why does it not see these files?
Finally found the problem - file system redirector had been causing the trouble. Using the C:\Windows\Sysnative\bash path works.
Thanks to all that tried to help.
Related
Trying to do CS50 week 1 practice problem "Debug'. I've followed it step by step repeatedly for hours and cant seem to get away from this error.
When I 'make' debug, I get an error saying
The term 'make' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again..
I can run Debug on code.cs50.io, but I'm unable to run debug on the actual VS Code App on windows 11. I tried to copy paste the code itself into code.cs50.io but I get this error
make debug
debug50 ./debug
Can't debug this program! Are you sure you are running debug50
on an executable, a Python script, or a Java program?
Unsupported File: ./debug
I am very new to VS Code and coding in general, so can someone please explain this to me ?
I did cs50 but it was a couple of years ago. I can’t remember if I did it on windows or linux. Anyway, I think the clue here is:
The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again..
If you have not installed make then you have to install it.
Try here:
https://stackoverflow.com/a/57042516/11112270
If you do have it installed, then the binary executable is not in $PATH env variable.
Try here:
https://stackoverflow.com/a/44958882/11112270
IMO, just develop on linux since it’s much easier to get tools you need. Unless cs50 requires windows?
How to remove the file path from terminal while running a code in visual studio code ?
Im using visual studio code with CodeRunner extension in Mac air M1.
I’ve tried to play with the terminal settings and I couldn't find the one that remove this.
I want that remove the part I marked in red, when i running my program.
Welcome to StackOverflow! 👋
This line is terminal command to compile source code file and run executable.
Soooo, I am not sure if you can remove this. What you can do is write bash script and give your file as an input, but anyway you will pass your file as an argument. What you can do is configure build task and run your executable file from terminal, but I'm not sure would you like this way or not.
As others mentioned this is the gcc (your c compiler) build command. Reason: You build and run your program. This should vanish when you explicit build. And then just run your program without build. Or open Terminal and run your binary with:
cd /Users/metanpolik/Desktop/VisualProjects
./heyc2
But like #UnholySheep wrote, what is the problem? It's just during developing with vs code and should not be a problem.
I have a very simple C console project that i programmed in eclipse juno (CDT plugin and mingw64 gcc compiler) I found that the eclipse console is treated like a file so when i call a printf function, it will not flush the buffer until told so explicitly.
I found that if i run the program from the command line directly then the buffer is flushed as it should. So..... i need to find a way to start my program from eclipse to run in the command line. I found solutions that i didn't really understand and solutions that i think are necessary (a batch file to run via the eclipse).
I'm looking for a more configurable solution such as specifying the cmd.exe somewhere in the project properties or creating a run configuration where I specify the path of the cmd.exe.
does anyone know such a way?
Don't know where to put this...
But I'm running Geany on 2 systems (laptop and desktop). On my laptop it works perfectly, but on my desktop when I run the code i get this error:
'"./whatevername"' is not recognized as an internal or external command, operable program or batch file
I can't figure out wtf is wrong with it. Any ideas?
If I may give a small help: you need to set the PATH variable. On Windows machines, it's in the registry. Here's how you do it:
http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx
Otherwise, whatever your compiler migth be (gcc, tcc, cpp) will not be found.
I have installed the lcc compiler so that I can compile c programs on my windows machine - but I am having troubles getting it to work...
I added C:\lcc\bin to my PATH environment variable, but when I type in:
lcc args
into my command line, I get this message: 'lcc is not recognized as an internal or external command, operable program or batch file'.
If I actually navigate to the folder C:\lcc\bin, I can execute lcc no problem
Is there something else I have to do other than set the PATH variable?
thanks!
I had also problems using lcc. By accident I started the editor that was also included in the package. Since then it works. I notice that I have to perform this operation each time I install it on a new computer. I suppose that it has to do with some initialization files that are required, but only created by the editor. Maybe this will also helps you.