I would like to see how Bash implements command line argument parsing and stepping through the code as it parses some trivial command should be a good way to do that. How do I set this up? Bash is normally run with
./configure
make
which creates a bash executable in the top level directory of the source code. I wanted to run that executable though GDB but it doesn't support M1 Macs so I was thinking to do it through VS Code but I don't know where to start.
To set up C/C++ debugging on VS Code, create a .vscode/launch.json file and fill in the arguments with whatever you need. See the docs here: https://code.visualstudio.com/docs/cpp/launch-json-reference.
That being said, VS Code's C/C++ debugger just hooks into an existing debugger like GDB or LLDB. If GDB can't debug your program, try LLDB (might require building Bash with LLVM instead of GCC- not 100% sure). If that's not an option, you might be out of luck with this exact question.
For setup with LLDB, see How to debug in VS Code using lldb?.
I'm using Matlab to generate some C code and MinGW is the compiler. This is how the toolchain is configured:
Once the build process is finished I get an executable file that I can run, and it works fine (it's just a simple Windows console program).
However, I can't find the options to run it automatically right after compilation. I've seen some code where they added ($PRODUCT) to the "Execute" option, but it didn't work for me. Any help is much appreciated!
Following the advice from here:
https://www.reddit.com/r/vim/comments/r6dthv/make_with_makefile_and_run_exe_from_same_command/
I added && start C:\...\test.exe (where ... is the full path) to the "Make Tool" option (bottom line) and it worked.
I want to build FuTTY.
The original author uses Visual Studio, I want to avoid that. I found out that apparently I have to:
Add MinGW/bin and MinGW/msys/1.0/bin to the PATH
run perl mkfiles.plto restore some missing makefiles
Remove -mno-cygwin from Makefile.cyg
Add XFLAGS = -DCOVERITY to Makefile.cyg
run make -f Makefile.cyg putty.exe from the windows directory
This works for building the original PuTTY, but is not enough for FuTTY.
It complains that KEY_WOW64_32KEY is undeclared. When I googled that, I found that apparently this means you need MinGW-W64.
At this point I'm making wild guesses, but I think the selector shown below means that the MinGW-W64 project is about making all kinds of toolchains run on Windows 64 bit and if I want something that works with PuTTY's MinGW makefile, I need this:
Right? So after downloading that, I am presented with questions I cannot answer:
I'm using more handy tool chain distribution MSYS2
I just installed Dev C++ and I am learning C programming.
the code i used was
#include <stdio.h>
int main()
{
printf("Hello world");
getch();
}
I saved it as a .c file. When I compile it works fine, but when I compile and run it says source file not compiled. So I googled buncha things and came across this video on youtube which shows you how to fix it. I also saw other forums on google which suggest the same thing... However, after doing whats asked, Now I can't even compile my code. I get this error
Compiler: Default compiler
Executing C:\Dev-Cpp\bin\gcc.exe...
C:\Dev-Cpp\bin\gcc.exe "C:\Users\ubaid\Documents\C\Untitled1.c" -o "C:\Users\ubaid\Documents\C\Untitled1.exe" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
gcc.exe: Internal error: Aborted (program collect2)
Please submit a full bug report.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.
Execution terminated
I have also used what is asked on this link, and still no luck..
http://learntogeek.com/miscellaneous/solved-source-file-not-compiled-error-in-dev-cpp/
I am using windows 8
I was having this issue and fixed it by going to:
C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2
, then deleting collect2.exe
Install new version of Dev c++. It works fine in Windows 8. It also supports 64 bit version.
Download link is http://sourceforge.net/projects/orwelldevcpp/ .
I guess you're using windows 7 with the Orwell Dev CPP
This version of Dev CPP is good for windows 8 only. However on Windows 7 you need the older version of it which is devcpp-4.9.9.2_setup.exe
Download it from the link and use it.
(Don't forget to uninstall any other version already installed on your pc)
Also note that the older version does not work with windows 8.
This maybe because the c compiler is designed to work in linux.I had this problem too and to fix it go to tools and select compiler options.In the box click on programs
Now you will see a tab with gcc and make and the respective path to it.Edit the gcc and make path to use mingw32-c++.exe and mingw32-make.exe respectively.Now it will work.
The reason was that you were using compilers built for linux.
You can always try doing it manually from the command prompt. Navigate to the path of the file and type:
gcc filename.c -o filename
I found a solution. Please follow the following steps:
Right Click the My comp. Icon
Click Advanced Setting.
CLick Environment Variable. On the top part of Environment Variable Click New
Set Variable name as: PATH then
Set Variable Value as: (" the location of g++ .exe" )
For ex. C:\Program Files (x86)\Dev-Cpp\MinGW64\bin
Click OK
This error occurred because your settings are not correct.
For example I receive
cannot open output file Project1.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe: *** [Project1.exe] Error 1
Because I have no permission to write on my exe file.
After some investigation, and with Dr.Topaz's help, I have learned that you will want to confirm that the program set for g++ in the Compiler Options really does compile the source code. In my case, the C:\Dev-Cpp\bin\g++.exe program did not create an exe, but the C:\Dev-Cpp\bin\c++.exe program did. Either program appears to be intended to take the same arguments and options as GNU g++. I would love to find an actual doc on the Dev-C++ compiler programs, but I have not so far.
You can test the compiler program with a simple example like this:
C:\Dev-Cpp\bin\c++.exe hello.cpp -o hello.exe
Currently in 2021, the Dev-C++ site invites you to download either original Dev-C++ or a newer fork by a group named Embarcadero.
I decided to try the Embarcadero version and the experience was slightly better. The UI is still a tad dated, but the g++.exe program it came with was able to compile programs without issue. Again, take note of where the program is being installed, but in my case, the Embarcadero compiler programs were in C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\bin.
Both original Dev-C++ and Embarcadero come with mingw-32 versions of the compiler programs that from what I see do work in a Git Bash console, with slight differences such as not recognizing a default locale when using the command std::cout.imbue(std::locale("")).
I faced this similar error, and none of the solutions worked.
so I tried to download the latest version from here, https://www.bloodshed.net/
I rerun the program.
and everything is now working correctly.
I was facing the same issue as described above.
It can be resolved by creating a new project and creating a new file in that project.
Save the file and then try to build and run.
Hope that helps. :)
I'm trying to compile a downloaded program in Windows. The program is usually run in Linux, but is programmed to also run in Windows (the code has #if defined(_WIN32)'s in it, and claims to work with borland free tools). When I try to use make from the command line, it tells me "Incorrect command line argument: -C". In the makefile, there are many lines that say "make -C" followed by a directory name. Does this syntax not work in Windows? What is a correct way to do this? Is there any way to compile this for native use in Windows with this makefile?
Windows itself doesn't come with a make utility. Microsoft does have a 'make' utility that comes with their development tools (such as Visual Studio, the Platform SDK, or the Windows Driver Kit) but it's called nmake.
You probably need GNU make to process those makefiles. you can get a copy for Windows here:
http://unxutils.sourceforge.net/
However, if the makefile isn't written to be able to be run on Windows, it'll probably not work well. You'll also need to make sure you have whatever other development tools the makefile calls upon (maybe the Borland compiler or GCC), and there may be other configuration that needs to be done specific to the project you want to build. It's probably not a matter of just having the correct make utility.
-C is "change working directory" only for the gmake command (from the GNU package). You should take a look in the manual for your Make-Utility and see, wheather it supports something äquivalent.
Peter
Are you using cygwin?
Are there any instructions for installing on windows(perhaphs in a README file)?