Author Topic: C::B and MS 2005 free compiler?  (Read 26431 times)

GeertVc

  • Guest
Re: C::B and MS 2005 free compiler?
« Reply #15 on: August 14, 2006, 03:25:28 pm »
OK, let's get some things straight first.

The Visual* Microsoft IDEs use the Ms debuggers "natively", i.e. communicating with the debugger DLLs through an API of some sort.

We don't have access to those DLLs and/or the API. So we must interface through a command-line frontend for the debugger. Much as we do with GDB.
This command-line frontend is cdb.exe. I don't know if it's part of the Visual* IDE editions. If you have one of them you can check for yourself. If it's there, no problem, put its path in "Additional paths" and it should work (assuming it is using the same text-interface as the standalone cdb.exe provided by Debugging Tools for Windows).
But, if cdb.exe is not on your hard disk, you must install the Debugging Tools for Windows which contain it, as said in my previous post.

Hi,

That already unveils a bit the way C::B is using the external debugger of M$.  Thanks for the explanation.

What I still do not understand is, why a new project isn't taking the default settings I've given for the compiler.

I've selected "Build -> Compiler options" (I have version 1.0 rc2 installed) and then created a "new" selection in the Select Compiler section, called Microsoft Visual C++ Toolkit 2005.  I've done this by copying the one for Visual Toolkit 2003 and modified all paths according the location for the C++ 2005 compiler.  That sounds fine, right?

I've added all related links to the compiler (exe dirs, include dirs, lib dirs, resource compiler dir, etc...) and pressed the Set as default button.

I've also added the new path to the debugger, as you explained.

To me, it's clear C::B should take this compiler with those settings as the default one.  However, if I create a new project, C::B still takes the GNU GCC Compiler as default one!

If I then manually select the Visual C++ Toolkit 2005 compiler selection I've created, all fields which were filled in for this Visual C++ Toolkit 2005 as default, are "vanished".  That's something I can't explain.

Even the object files aren't generated...

Hope this behaviour can be clarified, otherwise C::B is useless to me and that would be a pity...

By the way: are there no own tutorials available showing you in detail how to set up things?

Best rgds,

--Geert

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: C::B and MS 2005 free compiler?
« Reply #16 on: August 14, 2006, 04:15:18 pm »
Quote from: GeertVc
(I have version 1.0 rc2 installed)

but I said earlier:

Quote from: mandrav
Here are some facts regarding debugging with C::B nightlies.

Please try with a nightly build.
Be patient!
This bug will be fixed soon...

GeertVc

  • Guest
Re: C::B and MS 2005 free compiler?
« Reply #17 on: August 15, 2006, 08:30:40 am »
Please try with a nightly build.

Ok,

Tried the nightly build of August, 14th.

I have now a situation where I can at least compile my target.  I didn't reach this level so far...  The recent nightly build "detects" the Micro$oft Visual C++ 2005 installation automatically, that's fine.

But, when creating a new project, C::B is still not taking MS Visual C++ 2005 as a default compiler, despite the fact I selected it as the default one. 
It's still the GNU GCC compiler which is taken as default (which I'm absolutely not interested in under the Windows OS).  Still a problem?

At last, when I finally select the correct compiler after project creation, the object file is generated.

Next to this, when trying to debug, I get the following error:

Building to ensure sources are up-to-date
Build succeeded
Selecting target: Debug
Adding source dir: F:\AppData\_MyProgramData\CodeBlocks\Nightly\Geert\
Adding source dir: F:\AppData\_MyProgramData\CodeBlocks\Nightly\Geert\
Adding file: .\Geert.exe
Starting debugger: done
Setting breakpoints
Hello world!
Microsoft (R) Windows Debugger  Version 6.6.0007.5
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: ./Geert.exe
Symbol search path is: F:/AppData/_MyProgramData/CodeBlocks/Nightly/Geert/
Executable search path is:
ModLoad: 00400000 0040f000   image00400000
ModLoad: 7c900000 7c9b6000   ntdll.dll
ModLoad: 7c800000 7c8fe000   C:\WINDOWS\system32\kernel32.dll
(a9c.da0): Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffd5000 ecx=00000000 edx=00000001 esi=00241f48 edi=00241eb4
eip=7c901230 esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c901230 cc              int     3
*** WARNING: Unable to verify checksum for image00400000
*** ERROR: Module load completed but symbols could not be loaded for image00400000
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll -
Debugger finished with status 0


Any idea?  The path to the cdb.exe has been given correctly...

Best rgds,

--Geert

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: C::B and MS 2005 free compiler?
« Reply #18 on: August 15, 2006, 08:54:23 am »
Quote
Any idea?  The path to the cdb.exe has been given correctly...

Yes, cdb is launched now so you 're on the right track.
To generate debugging symbols for MSVC* projects, you have to add DEBUG in compiler #defines *and* add /DEBUG in the linker options. Add these two, rebuild and try debugging again.
Be patient!
This bug will be fixed soon...

GeertVc

  • Guest
Re: C::B and MS 2005 free compiler?
« Reply #19 on: August 15, 2006, 09:23:07 am »
you have to add DEBUG in compiler #defines *and* add /DEBUG in the linker options. Add these two, rebuild and try debugging again.

I was able to add DEBUG in the #define section of the compiler, but I was not able to add /DEBUG in the "Other linker options" section of the linker.

When placing the cursor in the "Other linker options" area, the cursor is jumping to the middle of the box.  Starting to type "/DEBUG" makes it jump to the left again and allows me to type in this linker option.

However, after pressing the "OK" button and re-opening the compiler settings, the linker option is gone (the compiler option on the contrary remains, so this one is apparently saved).

What is strange is that, for the libraries, there's an "Add" button, but for the linker options, there isn't.  Is this on purpose?


This is the compiler output I'm currently having.  You see the /DDEBUG has being added, meaning the compiler #define is indeed taken into account.

-------------- Build: Debug in ConsoleApp ---------------
cl.exe /nologo /W3 -g /DDEBUG  /ID:\WinApps\Programming\PlatformSDK\include /I"D:\WinApps\Programming\Microsoft Visual Studio 8\VC\include"  /c main.c /Foobj\Debug\main.obj
cl : Command line warning D9002 : ignoring unknown option '-g'
main.c
link.exe /nologo /LIBPATH:D:\WinApps\Programming\PlatformSDK\lib /LIBPATH:"D:\WinApps\Programming\Microsoft Visual Studio 8\VC\lib"  /out:.\ConsoleApp.exe  obj\Debug\main.obj   
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

For the linker, I don't see such option appearing...

There's also still a warning for the compiler "ignoring unknown option '-g'"

Best rgds,

--Geert

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: C::B and MS 2005 free compiler?
« Reply #20 on: August 15, 2006, 09:51:54 am »
Quote
When placing the cursor in the "Other linker options" area, the cursor is jumping to the middle of the box.  Starting to type "/DEBUG" makes it jump to the left again and allows me to type in this linker option.

However, after pressing the "OK" button and re-opening the compiler settings, the linker option is gone (the compiler option on the contrary remains, so this one is apparently saved).

Yes, libraries are files so you can select them through a file dialog, hence the buttons.

Other linker options are free-text so that you can use options C::B doesn't currently provide.
Anyway, I tried here to add /DEBUG in other linker options and it works fine. Yes, you may not see it there the next time you enter the dialog because this option is recognized by C::B. It's under the name "Produce debugging symbols" in compiler options. Try unchecking that option and checking it again.
The point is that unless /DEBUG is passed to the linker, debugging won't work.

Quote
There's also still a warning for the compiler "ignoring unknown option '-g'"

Remove that option. It's left there from when your project used GCC as compiler (when created).
Be patient!
This bug will be fixed soon...

GeertVc

  • Guest
Re: C::B and MS 2005 free compiler?
« Reply #21 on: August 15, 2006, 01:27:44 pm »
Anyway, I tried here to add /DEBUG in other linker options and it works fine. Yes, you may not see it there the next time you enter the dialog because this option is recognized by C::B. It's under the name "Produce debugging symbols" in compiler options. Try unchecking that option and checking it again.
The point is that unless /DEBUG is passed to the linker, debugging won't work.

Unless I explicitely activate the checkbox next to "Produce debugging symbols", I don't see the /DEBUG linker option when compiling my app (console app in C).  Adding /DEBUG in the "Other linker options" and as a result the checkbox mentioned beforehand is checked, simply doesn't work in my case...

Anyway, even when I check this checkbox, it still doesn't solve my debug problem. 

This is the output of the compilation:

-------------- Build: Debug in ConApp ---------------
cl.exe /nologo /W3 /Zi /D_DEBUG /DDEBUG /DDEBUG  /ID:\WinApps\Programming\PlatformSDK\include /I"D:\WinApps\Programming\Microsoft Visual Studio 8\VC\include"  /c main.c /Foobj\Debug\main.obj
main.c
link.exe /nologo /LIBPATH:D:\WinApps\Programming\PlatformSDK\lib /LIBPATH:"D:\WinApps\Programming\Microsoft Visual Studio 8\VC\lib"  /out:.\ConApp.exe  obj\Debug\main.obj   /DEBUG
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

You see the /DEBUG option at the end of the linker syntax, but it's only there because I checked the checkbox, not because I've added it in the "Other linker option" section.

This is the output of the debugger (not much of improvement):

Building to ensure sources are up-to-date
Build succeeded
Selecting target: Debug
Adding source dir: F:\AppData\_MyProgramData\CodeBlocks\Nightly\ConApp\
Adding source dir: F:\AppData\_MyProgramData\CodeBlocks\Nightly\ConApp\
Adding file: .\ConApp.exe
Starting debugger: done
Setting breakpoints
Hello world!
Microsoft (R) Windows Debugger  Version 6.6.0007.5
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: ./ConApp.exe
Symbol search path is: F:/AppData/_MyProgramData/CodeBlocks/Nightly/ConApp/
Executable search path is:
ModLoad: 00400000 00426000   ConApp.exe
ModLoad: 7c900000 7c9b6000   ntdll.dll
ModLoad: 7c800000 7c8fe000   C:\WINDOWS\system32\kernel32.dll
(a58.83c): Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffd5000 ecx=00000000 edx=00000001 esi=00241f48 edi=00241eb4
eip=7c901230 esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c901230 cc              int     3
*** WARNING: Unable to verify checksum for ConApp.exe
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll -
Debugger finished with status 0



Remove that option. It's left there from when your project used GCC as compiler (when created).
Done.  Warning is gone, as can be seen when looking to the compiler output generated.

Best rgds,

--Geert

GeertVc

  • Guest
Re: C::B and MS 2005 free compiler?
« Reply #22 on: August 15, 2006, 01:36:34 pm »
This is the debugger output I get when building a WinGui app from the template:

Building to ensure sources are up-to-date
Build succeeded
Selecting target: Debug
Adding source dir: F:\AppData\_MyProgramData\CodeBlocks\Nightly\WinGui\
Adding source dir: F:\AppData\_MyProgramData\CodeBlocks\Nightly\WinGui\
Adding file: bin\Debug\WinGui.exe
Starting debugger: done
Setting breakpoints
Hello world!
Microsoft (R) Windows Debugger  Version 6.6.0007.5
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: bin/Debug/WinGui.exe
Symbol search path is: F:/AppData/_MyProgramData/CodeBlocks/Nightly/WinGui/
Executable search path is:
ModLoad: 00400000 0041e000   WinGui.exe
ModLoad: 7c900000 7c9b6000   ntdll.dll
ModLoad: 7c800000 7c8fe000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 77d10000 77da0000   C:\WINDOWS\system32\USER32.dll
ModLoad: 77e40000 77e87000   C:\WINDOWS\system32\GDI32.dll
(f9c.a40): Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffde000 ecx=00000006 edx=00000040 esi=00241f48 edi=00241eb4
eip=7c901230 esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c901230 cc              int     3
*** WARNING: Unable to verify checksum for WinGui.exe
Breakpoint 1 hit
At F:\AppData\_MyProgramData\CodeBlocks\Nightly\WinGui\main.cpp:19


But here, I must say it works, despite the ERROR message I see...

Best rgds,

--Geert
« Last Edit: August 15, 2006, 01:45:51 pm by GeertVc »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: C::B and MS 2005 free compiler?
« Reply #23 on: August 15, 2006, 02:50:56 pm »
This error message appears because you don't have the debug symbols of various system DLLs. Get used to it ;).
Be patient!
This bug will be fixed soon...