[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

MSC version unmatch

Brog

12/23/2006 11:02:00 PM

So, I'm writing a program which uses SWIG to interface between C++ and
Ruby, and I just upgraded my Ruby version from an older version (I
think 1.8.2) to the current stable release (1.8.5). Now when I compile
(in MSVS2003) I receive "fatal error C1189: #error : MSC version
unmatch" from Ruby's config.h, from these lines:
#if _MSC_VER != 1200
#error MSC version unmatch
#endif
If I comment out these lines, I then get errors from ostream and
istream:
ostream(491) : warning C4003: not enough actual parameters for macro
'write'
ostream(490) : error C2059: syntax error : ')'
and so on.

Does anyone have a solution to this problem?

2 Answers

Nobuyoshi Nakada

12/24/2006 4:37:00 AM

0

Hi,

At Sun, 24 Dec 2006 08:05:05 +0900,
crysknife@gmail.com wrote in [ruby-talk:231120]:
> So, I'm writing a program which uses SWIG to interface between C++ and
> Ruby, and I just upgraded my Ruby version from an older version (I
> think 1.8.2) to the current stable release (1.8.5). Now when I compile
> (in MSVS2003) I receive "fatal error C1189: #error : MSC version
> unmatch" from Ruby's config.h, from these lines:
> #if _MSC_VER != 1200
> #error MSC version unmatch
> #endif

You can't mix ruby compiled with Visual C++ version 6 and
extensions compile with Visual C++ version 7 (MSVS2003), or
vice versa, due to the binary incompatibility between MSVC
runtime DLLs which those compilers use.

The only possible alternatives are:

a) compile your extension with VC6 (or mingw), or
b) compile ruby (and other extensions if you need) by yourself
with VC7.

--
Nobu Nakada

Jano Svitok

12/24/2006 1:45:00 PM

0

On 12/24/06, crysknife@gmail.com <crysknife@gmail.com> wrote:
> So, I'm writing a program which uses SWIG to interface between C++ and
> Ruby, and I just upgraded my Ruby version from an older version (I
> think 1.8.2) to the current stable release (1.8.5). Now when I compile
> (in MSVS2003) I receive "fatal error C1189: #error : MSC version
> unmatch" from Ruby's config.h, from these lines:
> #if _MSC_VER != 1200
> #error MSC version unmatch
> #endif
> If I comment out these lines, I then get errors from ostream and
> istream:
> ostream(491) : warning C4003: not enough actual parameters for macro
> 'write'
> ostream(490) : error C2059: syntax error : ')'
> and so on.

You're facing two issues:
1. compiling extension with another compiler than ruby was compiled with.
2. 1.8.5 has problems with stl, namely iostrem.

1. You may be lucky, and it might work. Just comment out the check.
DANGER!!! You may encounter strange bugs if you try! That being said,
for me it worked somehow (ruby VC6, ext VC8) - my extension is a
really thin layer that just copies memory chunks back and forth. I'm
not sure what the dangerous areas are, I remember hearing something
about files and errno.

If you can't compile your extension with VC6 or mingw, compiling ruby
+ oneclick installer with VC8 is a matter of a few hours. (I didn't
test too extensively the result, though). Just download the ruby
source tarball, read the readme in win32 dir, set your paths and start
whatever the readme tells you. One-click the same - checkout/export
trunk, and follow the readme. I had to download some things manually
from other sources, as their main site didn't work that time.

2. I had a similar problem. I got around it by #undef'ing write and
read before I #included <iostream>

Now that I think of it, I should have filed a bug... I have just done
that: #7431.