Building wxruby on windows with Visual C++ Express Edition

Hello,
Sorry for bothering You with so many questions, but I’m trying to build
wxruby from svn and wxWindgets 2.8.8 using Visual C++ 2008 Express
Edition.
I builded wxWindgets following instructions
http://wiki.wxwidgets.org/Compiling_WxWidgets and
http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets
It compiled without any errors.
But on linking step of wxruby build process error occurs. May be another
compiler should be used or I missconfigured something?
Configurations that I’ve made: switched runtime library to
“Multi-Threaded (/MT)” for all projects and in ‘include/wx/msw/setup.h’
defined
wxUSE_UNICODE, wxUSE_GLCANVAS and wxUSE_GRAPHICS_CONTEXT to 1

link swig/wx.res obj/AboutDialogInfo.obj ……
c:/ruby
/lib/msvcrt-ruby18.lib /dll /out:lib/wxruby2.so
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall
std::basic_string<
char,struct std::char_traits,class std::allocator

::~basic_string<c
har,struct std::char_traits,class std::allocator >(void)"
(??1?$basi
c_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already
defined i
n wxmsw28u_core.lib(graphics.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: unsigned int
__thiscall std::
basic_string<char,struct std::char_traits,class
std::allocator >::si
ze(void)const "
(?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@s
td@@QBEIXZ) already defined in wxmsw28u_core.lib(graphics.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: “public: __thiscall
std::basic_string<
char,struct std::char_traits,class std::allocator
::basic_string<ch
ar,struct std::char_traits,class std::allocator >(char const
*)” (??
0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z)
already
defined in wxmsw28u_core.lib(graphics.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: “public: __thiscall
std::basic_string<
char,struct std::char_traits,class std::allocator
::basic_string<ch
ar,struct std::char_traits,class std::allocator >(class
std::basic_s
tring<char,struct std::char_traits,class std::allocator >
const &)”
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
a
lready defined in wxmsw28u_core.lib(graphics.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: char const *
_thiscall std::
basic_string<char,struct std::char_traits,class
std::allocator >::c

str(void)const "
(?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
@std@@QBEPBDXZ) already defined in wxmsw28u_core.lib(graphics.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter_noinfo
already defin
ed in MSVCRT.lib(MSVCR90.dll)
Creating library lib/wxruby2.lib and object lib/wxruby2.exp
LINK : warning LNK4098: defaultlib ‘LIBCMT’ conflicts with use of other
libs; us
e /NODEFAULTLIB:library
lib/wxruby2.so : fatal error LNK1169: one or more multiply defined
symbols found

rake aborted!
Command failed with status (145): [link swig/wx.res
obj/AboutDialogInfo.obj…
]
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:899:in sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:906:in call’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:906:in sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:985:in sh’
./rake/rakewx.rb:100
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:544:in call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:544:in execute’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in execute’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in
invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in synchronize’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:518:in invoke_prerequisit
es’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in send’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:515:in invoke_prerequisit
es’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:507:in
invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in synchronize’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in invoke’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in
invoke_task' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in top_level’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in top_level’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
standard_exceptio n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in top_level’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in standard_exceptio
n_handling’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 c:/ruby/bin/rake:16:in load’
c:/ruby/bin/rake:16

Max

Max S. wrote:

Sorry for bothering You with so many questions,
Your questions are welcome; it’s what this list is for.

but I’m trying to build
wxruby from svn and wxWindgets 2.8.8 using Visual C++ 2008 Express

Great - it would be good to have more people building from SVN on
Windows as though the platform’s used a lot, the development team are
primarily OS X & Linux based.

However, I’m pretty sure you can’t build wxRuby (or any other ruby
extension) with Visual Studio 2008. I’m assuming you’re using a ruby
installed from the One-Click or similar (you can check by doing ruby
-v). The released ruby builds are built with VS 6, and VS2008 can’t be
used to compile extensions for this. You’ll get the kind of weird errors
you seem to be getting.

You have two ways to get around this. You could try and get hold of a
copy of VS6, but Microsoft don’t make it available anywhere. I think I
may have tracked down a copy in my University Library.

What I would strongly recommend, though, is to look into using MingW -
which is gcc for Windows, and therefore free. It will soon be used as
the preferred compiler for Ruby, and wxRuby, on Windows. It takes
slightly longer to compile, but produces significantly faster-running
code.

Luis L. provides a handy start pack which includes a a Ruby built
with mingW, and the compiler.

Mario wrote a pretty comprehensive page about setting up wxRuby for use
with MingW, from installing MingW to compiling WxWidgets and wxRuby.
http://wxruby.rubyforge.org/wiki/wiki.pl?NotesOnMingW

Very happy to help further with this - might be more appropriate to
follow up on the -dev list if you want:
http://rubyforge.org/mailman/listinfo/wxruby-development

cheers
alex