Author Topic: gdb can't find files: /cygdrive/c/cpp/Dice/Dice.cpp  (Read 422 times)

Offline gamemaster3000

  • Single posting newcomer
  • *
  • Posts: 2
gdb can't find files: /cygdrive/c/cpp/Dice/Dice.cpp
« on: March 17, 2018, 08:05:00 pm »
Beginning user, have a little Craps simulator I wrote that is compiling and running fine.  Tried to use the debugger and I'm getting:

Cannot open file: /cygdrive/c/cpp/Dice/Dice.cpp

full thing:
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\cpp\Dice\
Adding source dir: C:\cpp\Dice\
Adding file: C:\cpp\Dice\bin\Debug\Dice.exe
Changing directory to: C:/cpp/Dice/.
Set variable: PATH=.;C:\cyg\bin;C:\cyg;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\EmEditor;c:\cyg;c:\cyg\bin;C:\Users\ScottNew\AppData\Local\Microsoft\WindowsApps
Starting debugger: C:\cyg\bin\gdb.exe -nx -fullname -quiet  -args C:/cpp/Dice/bin/Debug/Dice.exe
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Child process PID: 8908
Cannot open file: /cygdrive/c/cpp/Dice/Dice.cpp
At /cygdrive/c/cpp/Dice/Dice.cpp:92
Debugger finished with status 0


I originally couldn't get it to find gdb, but then I went to Cygwin and downloaded it, that seemed to help.  :-)

If I open up the cygwin64 terminal it seems to be able to find it just fine though.
https://ibb.co/gxr7Cx

Also I saw the -g in the build info so I'm pretty sure the project was built with debugging info. 

I found some stack overflow articles that seemed similar, but they were like 4 years old.  I downloaded codeblocks last week (March 2018).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6278
    • My Best Post
Re: gdb can't find files: /cygdrive/c/cpp/Dice/Dice.cpp
« Reply #1 on: March 17, 2018, 08:10:23 pm »
I just wish to make sure that you wish to use the CygWin GCC, correct?

I think that the suggested work around for this problem was to use the native CygWin compiler and to use the MinGW CygWin debugger.

The Cygwin installer has mingw gdb programs.

Remember to set CB debugger up to use the newly installed cygwin mingw gdb

Edit: Please post back details if this idea fixes the problem.

Tim S.
« Last Edit: March 17, 2018, 08:13:44 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline gamemaster3000

  • Single posting newcomer
  • *
  • Posts: 2
Re: gdb can't find files: /cygdrive/c/cpp/Dice/Dice.cpp
« Reply #2 on: March 17, 2018, 08:41:40 pm »
TY, I'll take a look at this when I get home from work. 

I don't understand the difference between Cygwin, MinGW, MSYS, POSIX, whatever.  I just want my program to work. 

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1913
Re: gdb can't find files: /cygdrive/c/cpp/Dice/Dice.cpp
« Reply #3 on: March 17, 2018, 09:25:12 pm »
What version (what installer) of Codeblocks do you use?
Do you use the compiler provided by codeblocks, or do you use your own compiler?
Do you need posix code functionality?

did you installed cygwin only for gdb?

Cygwin is a posix environment for windows. POSIX is a api standard for operating systems (fully supported only by unix ?and bsd? systems) windows supports it partially. MinGW is a collection of windows ported gcc build tools and windows headers so you can compile windows programs with gcc. MSYS is something like cygwin but only for the build environment. Codeblocks is an IDE for different languages and compilers. Wikipedia is (as always) your friend...

If you want compile and debug native code for windows you can use MinGW with gcc or msvc and the windows sdk, both with codeblocks. If you want to use codeblocks i recommend MinGW (this is sufficient as long as you won't build hardware drivers)
If you want compile and debug posix conform code you need cygwin and still can use codeblocks.

So what do you want?