So I tried to check Mingw-w64 tools are correctly installed and gcc, g++ were correctly installed but gdb wasn't. I'm planning to usE Visual studio code in windows 10.
In the https://code.visualstudio.com/docs/cpp/config-mingw#_run-helloworldcpp, it said to match PATH entry but when I went to C:\msys64\mingw64\bin directory, the file was empty. Did I miss something or how do I know the correct path to put in the environment variable?
I tried C:\msys64\mingw64\bin as both user variable & system variable path but it won't work. and it said command not found.
This is what it said.
$ gdb --version
bash: gdb: command not found
Try installing GDB by running this in your Bash shell:
pacman -S $MINGW_PACKAGE_PREFIX-gdb
Related
I am trying to build an embedded program using "make all" with the GNU ARM toolchain, but it is not working yet.
I installed it with xpm according to this website with the xpm installer:
https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
Now when I try to build my program using "make all", I get following error:
$ make all
Collecting dependencies for: Bsp/....cpp
/bin/sh: Zeile 1: arm-none-eabi-gcc: Command not found-
...
The file is of course located in the xpack location:
C:\Users\\AppData\Roaming\xPacks
while the normal mingw64 binaries are in another location. How exactly can I use arm-none-eabi-gcc now or how can I edit the PATH variables of msys2 to use the xpm packages?
There is also a similar toolchain here:
https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa
But I guess I can not install this without something like Linux subsystem...
If you downloaded arm-none-eabi-gcc separately from MSYS2, then after starting your MSYS2 shell, you need to add whatever directory contains arm-none-eabi-gcc.exe to your PATH environment variable by running a command like this:
export PATH=$PATH:/c/Users/path/to/bindir/
You can test it by running arm-none-eabi-gcc in the shell with no arguments, and also running which arm-none-eabi-gcc.
The main place to download such a toolchain is here:
https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain
You can install arm-none-eabi-gcc on MSYS2 using its package manager.
Start MSYS2 using mingw64.exe (or the equivalent shortcut) and then install the toolchain by running:
pacman -S mingw-w64-x86_64-arm-none-eabi-gcc
Now arm-none-eabi-gcc should be on your PATH without any additional work.
When debugging a C++ project in Eclipse I get the following error:
'Launching Project.exe' has encountered a problem.
Could not determine GDB version using command:
D:\Programme\MinGW\bin\gdb.exe --version
Some Posts on Stackoverflow suggested linking MinGW\bin\gdb.exe directly in the C++/GDB settings solves the problem, but as you can see it didn't for me.
Any suggestions?
Edit: Tried mingw-get.exe install gdb in MinGW\bin, got an error that said the latest version is already installed.
I found the solution for my --version error:
When I ran $ gdb --version from the MinGW shell I got an error message saying zlib1.dll was not found.
I copied zlib1.dll from the \Debug folder of my C++ project into MinGW\bin and now it's working.
If gdb --version works in cmd, then try change path in eclipse - run - debug configurations - debugger - GDB debugger to C:\MinGW\gdb64\bin\gdb.exe, the default one in C:\MinGW\bin could be 32-bit.
I have a C++ project imported to Eclipse CDT. I can build and run the project using Makefile and argument settings. However, when I tried to add a debug point and run "debug as local c/c++ application", it throws me an error of "Launching projectName" has encountered a problem. Error with command gdb --version
By expanding the Details, it gives: Error with command: gdb --version
Cannot run program "gdb": Unknown reason
I installed the gdb by Macports before. If I enter command ggdb it returns the version info. If I type which ggdb, it gives /opt/local/bin/ggdb. I tried to add "PATH" to debug configuration -> environment variables and give the path value to it, but it did not work. How should I set the path and link the path please? And what should the variable name be.
The gdb version on my machine is GNU gdb (GDB) 7.7.1
Added: I looked up which ggdb and used the link James provided to change gdb debugger to browse to that path. But it did not work still.
Thanks.
It looks like Eclipse is using the default gdb that was on the system before you installed ggdb from macports. This link shows how to change the debugger settings, change it to ggdb which is the name Macport uses.
After installing ggdb from Macports you will have to sign it with a certificate so it will be allowed to control other processes, take a look at "Certifying GDB" here. After creating the certificate, make sure you select the correct name when signing:
$ codesign -s gdb-cert $(which ggdb) /// 'ggdb'
I'm trying to compile a simple helloworld program with MinGW on Windows and nothing happens. No output, no executable, nothing. I've just installed the latest MinGW with their mingw-get-inst-20120421.exe installer. When I use an older version of MinGW that came with Code::Blocks, I am able to compile the program. I'm out of ideas and my googling has been in vain. C:\MinGW\bin is on my path and I'm using MSYS.
Command line parameters in MSYS:
gcc helloworld.c -o helloworld
Execute the console from the Start menu, Start->MingW->MinGW Shell or from filesystem:
C:\MinGW\msys\1.0\msys.bat
Execute gcc in this shell.
Otherwise you will have to add the minGW/bin directory to your PATH environment variable.
Go to the directory where you have you gcc executable. In my case it's:
C:\MingW\bin
From there execute gcc:
gcc myFile.c
If it compiles, than something must screwed up your $PATH
I have installed Eclipse and CDT (to use C/C++ in eclipse CDT is needed), as well as installing Cygwin so that I can compile my files.
In environment variables I've set Path to include the following: "C:\cygwin\bin;"
g++, make and GDC are all installed via Cygwin. I made sure of this by searching for them in the bin folder - they're all there.
If I enter "make" into the windows command prompt, this appears:
make: *** No targets specified and no makefile found. Stop.
If I enter "g++" or "gdc" into the windows command prompt, this appears (or similar):
'g++' is not recognized as an internal or external command,
operable program or batch file.
So, in other words make is working but the rest isn't..but they're in the same bin folder! Has got me completely confused.
If I attempt to open Cygwin Bash Shell, g++, make and GDC all work there.
However, I need it to work in the command prompt so that Eclipse is able to compile the programs I write in the IDE.
If you know why this is happening, please let me know.
I haven't used cygwin much, but my understanding is you have to use it from the cygwin bash shell.
if you need g++, make, etc, use mingw, with it, g++ works from the normal windows command line.
Here is what happened to me and how I fixed it.
My C:\cygwin\bin\g++.exe is a shortcut pointing to C:\etc\alternatives\g++.exe, which points back to C:\cygwin\bin\g++-3.exe.
Replacing g++ with g++-3 worked for me.
In C:\cygwin\bin see whether g++.exe is there. If not, the installation wasn't done properly and you may need to install again. That's what was my problem and it's resolved :)
Adding the cygwin paths to the Path variable worked for me (windows 8.1 64 bit):
Go to system properties and select advanced system properties
Go to environment variables and select Path in system variables, click edit
Add the Cygwin paths...
for 32 bit:
C:\Cygwin\bin;C:\Cygwin\usr\bin
for 64 bit:
C:\Cygwin64\bin;C:\Cygwin64\usr\bin
In the CMD window, try typing bash to start a bash shell in that window. If that doesn't work, then the cygwin bin directory is not on your path.
If it did work, enter type g++ and type make to see the paths that are being used for these commands. I'm pretty sure your problem is with your PATH variable.
You could install a Windows version of which to get some help in figuring out exactly which executables are being run.
Perhaps it's picking up 'make' from somewhere completely different, and your addition to %PATH% is not working.
Also verify it by typing echo %path% in the same command prompt window as you're seeing the problem in, just to make sure.