I installed the Code::Blocks on a Windows 10 PC using the downloaded binary codeblocks-20.03-setup.exe. I adjusted the settings to point to my Msys2 MinGW compiler C:\msys64\mingw64
and debugger C:\msys64\usr\bin\gdb.exe
. I then created a project with the default console app in c using Code::Blocks. It can compile and run using Code::Blocks.
When I debug it it fails. Code::Blocks gives an error:
Cannot open file: /c/GitLab/debugging-c-code/Exercise Files/Ch02/02_01/02_02_ide/main.c
At /c/GitLab/debugging-c-code/Exercise Files/Ch02/02_01/02_02_ide/main.c:6
The main.c file is open in Code::Blocks. I assume the /c/
vs c:\
part is the problem. I have no idea how to resolve the problem for Code::Blocks.
My Setup:
[..]which gcc
gcc is an external : C:\msys64\usr\bin\gcc.exe
[...]gcc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[...]which gdb
gdb is an external : C:\msys64\usr\bin\gdb.exe
[...]gdb --version
GNU gdb (GDB) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3 : GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
CodePudding user response:
I solved the problem ... after reading the comment from HolyBlackCat. Cygwin will mangle paths because it assumes it is inside the Cygwin environment.
Updated my MSYS installation and installed GDB as part of a complete toolchain:
pacman -S mingw-w64-x86_64-toolchain
Now GDB, GCC and Codeblocks are happy with each other and sharing debug information in a way that everybody understands. Now both GDB and GCC reside in C:\msys64\mingw64
.
I originally only installed only GCC and then the other parts as I needed them.
CodePudding user response:
Make sure you don't have any special characters (spaces, non ASCII characters) in the paths where CodeBlocks, MinGW-w64 or your source projects are located.
More info on how you can configure CodeBlocks with MinGW-w64 can be found here: https://winlibs.com/#usage-codeblocks