Author Topic: Using VC Toolkit to compile C::B  (Read 20474 times)

Cyberax

  • Guest
Using VC Toolkit to compile C::B
« on: September 25, 2005, 04:37:28 pm »
I've finally managed to compile C::B using VC 2003 Toolkit (actually, I used VisualStudio 2003) in Unicode. Now it can be debugged using a superb VisualStudio debugger :)

During this process I've fixed numerous incompatibilities. Here are the major ones:
  • 1. VC's preprocessor doesn't support variable number of parameters in macroses. So I had to correct CFG_READ and CFG_WRITE.
  • 2. VC's preprocessor doesn't understand such constructs:
Code
SomeFunc(_("Text, text, text"
                   "text continues"
                   "end of text"));
It rewrote all such occurrences to:
Code
SomeFunc(_("Text, text, text"
                   _T("text continues")
                   _T("end of text")));

[li]3. I've added correct class exports, so SDK can now be built as a DLL with VC.[/li]
[/list]

You can download patched codeblocks from: http://scb.udsu.ru/~cyberax/codeblocks_vc.zip

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Using VC Toolkit to compile C::B
« Reply #1 on: September 25, 2005, 04:52:43 pm »
Thanks for the effort.
Where's that patch again? ;)
Be patient!
This bug will be fixed soon...

grv575

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #2 on: September 25, 2005, 08:45:19 pm »
For #2, are you sure they are equivalent?

Also, you sure

Code
SomeFunc(_("Text, text, text" \
                   "text continues" \
                   "end of text"));

doesn't work?

sanjivg

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #3 on: September 26, 2005, 10:04:54 am »
Also it would be good if you could come up with some write up to build c::b using Visual Studio.
I am also facing problems while debugging c::b using gdb on windows. i am not able to debug plugins, even after following the suggested method of putting a breakpoint in ScanforPlugins and then by adding the symbol file.

Thanks
Sanjiv

Cyberax

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #4 on: September 26, 2005, 10:48:53 am »
For #2, are you sure they are equivalent?
Yes, I am sure.

Quote
Also, you sure
Code
SomeFunc(_("Text, text, text" \
                   "text continues" \
                   "end of text"));
doesn't work?

Yes. In Unicode mode '_("Text")' is exapanded to 'L"Text"', so this code will look like:
Quote
SomeFunc(L"Text, text, text" \
                   "text continues" \
                   "end of text");
This is not a Standard-compliant code and VC7.1 will not compile it ("error C2308: concatenating mismatched wide strings").

Just for reference, ISO/IEC 14882:2003(E) 2.13.4.3:
Quote
If a narrow string literal token is adjacent to a wide string literal token, the behavior is
undefined.
« Last Edit: September 26, 2005, 11:00:41 am by Cyberax »

Cyberax

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #5 on: September 26, 2005, 10:52:16 am »
Also it would be good if you could come up with some write up to build c::b using Visual Studio.
I am also facing problems while debugging c::b using gdb on windows. i am not able to debug plugins, even after following the suggested method of putting a breakpoint in ScanforPlugins and then by adding the symbol file.
There's no need to build C::B using VisualStudio, you can export makefile from C::B and build it using VS's "Makefile project". I'm going to add this to wiki as soon as I have some spare time.
« Last Edit: September 26, 2005, 11:03:41 am by Cyberax »

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Using VC Toolkit to compile C::B
« Reply #6 on: September 26, 2005, 02:05:07 pm »
I've finally managed to compile C::B using VC 2003 Toolkit (actually, I used VisualStudio 2003) in Unicode. Now it can be debugged using a superb VisualStudio debugger :)
...
You can download patched codeblocks from: http://scb.udsu.ru/~cyberax/codeblocks_vc.zip

Hello Cyberaxe
i downloaded your patch but i couldn't find any of the necessary project files to build it with VS2003.
Can you please supply these along with a short description how to build the codeblocks project with VS ?
thanks

Cyberax

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #7 on: September 26, 2005, 02:44:50 pm »
  • 1. Compile wxWidgets:
Code
cd <WXWIN>\build\msw
nmake -f makefile.vc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1 VENDOR=cb clean
nmake -f makefile.vc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1 VENDOR=cb

[li]2. Open CodeBlocks-wx-vc.cbp with C::B and compile it.[/li]
[/list]

NOTE: C::B and wxWidgets will be compiled in debug mode (VC can't mix debug and release code well enough).

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Using VC Toolkit to compile C::B
« Reply #8 on: September 26, 2005, 02:53:57 pm »
...
2. Open CodeBlocks-wx-vc.cbp with C::B and compile it

thanks, :shock: didn't see the wood for the trees 

grv575

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #9 on: September 27, 2005, 03:31:24 am »
Oh, it's just "abc" "cde";

So

Code
SomeFunc(_("Text, text, text \
                   text continues \
                   end of text"));
gives extra whitespace or no? (forget)

Anycase I didn't realize it was just standard concatenation.

Cyberax

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #10 on: September 27, 2005, 01:07:50 pm »
Code
SomeFunc(_("Text, text, text \
                   text continues \
                   end of text"));
gives extra whitespace or no? (forget)
Yes, it does.

Anyway, the Right Thing (tm) to do is using resource bundles. Maybe someone should bite the bullet and extract all text strings to resource files?

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Using VC Toolkit to compile C::B
« Reply #11 on: September 27, 2005, 02:58:12 pm »
  • 1. Compile wxWidgets:
  • 2. Open CodeBlocks-wx-vc.cbp with C::B and compile it.
NOTE: C::B and wxWidgets will be compiled in debug mode ...

Hi Cyberax
now i've build C::B with VisualStudio2003 (VC7.1)
using your project file adapted for wxMSW2.6.1_ansi_debug_dll
with the unicode version i couldn't open a single file !

well, the result isn't exciting till now.

It compiles with 124 warnings and works with a number of flaws (but no crash till now) and runs terribly slow !
There is a lot of work to do until we have a M$-VS port of C::B, but a start is made ...

thanks again for your input, Cyberax.

Cyberax

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #12 on: September 27, 2005, 05:02:20 pm »
now i've build C::B with VisualStudio2003 (VC7.1)
using your project file adapted for wxMSW2.6.1_ansi_debug_dll
with the unicode version i couldn't open a single file !
It's strange, Unicode version of C::B worked fine for me. I was able to compile C::B from it.


Quote
well, the result isn't exciting till now.
I know  :(

Quote
It compiles with 124 warnings and works with a number of flaws (but no crash till now) and runs terribly slow !
There is a lot of work to do until we have a M$-VS port of C::B, but a start is made ...
I've fixed some warnings in my working copy. I was also able to compile a release version of C::B (and it runs very fast), but it crashed during compilation.

I'd greatly appreciate project admins giving me a write access in CVS (in a branch or a separate directory), so I can share my bugfixes.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Using VC Toolkit to compile C::B
« Reply #13 on: September 27, 2005, 05:14:22 pm »
Quote from: Cyberax
...
I've fixed some warnings in my working copy.
I was also able to compile a release version of C::B (and it runs very fast), but it crashed during compilation.
There is something bad with event handling  - the speed-difference between debug and release versions can't be that big. My build consumes up to 95% of cpu-power just when moving the mouse around the C::B-window ! The menus react with 0.5 to 2 sec. delay ! terrible slow !

Quote from: Cyberax
I'd greatly appreciate project admins giving me a write access in CVS (in a branch or a separate directory), so I can share my bugfixes.
you can make patch-files, zip them, then rename the extension .zip to .txt and post the files here in this thread.

Cyberax

  • Guest
Re: Using VC Toolkit to compile C::B
« Reply #14 on: September 27, 2005, 05:45:48 pm »
Quote from: Cyberax
There is something bad with event handling  - the speed-difference between debug and release versions can't be that big. My build consumes up to 95% of cpu-power just when moving the mouse around the C::B-window ! The menus react with 0.5 to 2 sec. delay ! terrible slow !

Can you check your debugger log? If C::B constantly writes messages there, it can easily slow everything by the factor of 10.

Quote from: Cyberax
I'd greatly appreciate project admins giving me a write access in CVS (in a branch or a separate directory), so I can share my bugfixes.
you can make patch-files, zip them, then rename the extension .zip to .txt and post the files here in this thread.
I'm going to setup a private SVN repository (with anonymous read-only access) and sync it with the main C::B repository using SVK (http://svk.elixus.org/).