# Problems compiling Ruby extension in MSVC

**URL:** <https://www.ruby-forum.com/t/problems-compiling-ruby-extension-in-msvc/96973>\
**Category:** Ruby\
**Created:** [January 25, 2006, 3:19am UTC](https://www.ruby-forum.com/t/problems-compiling-ruby-extension-in-msvc/96973 "2006-01-25T03:19:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sriyansa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@Sriyansa](https://www.ruby-forum.com/u/Sriyansa)\
**Post date:** [January 25, 2006, 3:19am UTC](https://www.ruby-forum.com/t/problems-compiling-ruby-extension-in-msvc/96973/1 "2006-01-25T03:19:38Z")

</div>

I am trying to compile my ruby extension under Windows with the MSVC  
compiler shipped with Visual Studio 2003. I have followed the steps  
outlined here:

[http://www.koontzfamily.org/david/blog/?p=230](http://www.koontzfamily.org/david/blog/?p=230)

However on doing nmake I get the following errors:

cl : Command line warning D4024 : unrecognized source file type  
‘files/ruby/lib/ruby/1.8/i386-mswin3  
2’, object file assumed  
cl : Command line warning D4027 : source file  
‘files/ruby/lib/ruby/1.8/i386-mswin32’ ignored  
cl : Command line warning D4024 : unrecognized source file type  
‘files/ruby/lib/ruby/1.8/i386-mswin3  
2’, object file assumed  
cl : Command line warning D4027 : source file  
‘files/ruby/lib/ruby/1.8/i386-mswin32’ ignored  
Test.c  
Test.c(1) : fatal error C1083: Cannot open include file: ‘ruby.h’: No  
such file or directory  
NMAKE : fatal error U1077: ‘cl’ : return code ‘0x2’  
Stop.

It seems that the compiler does not like spaces in the include path (My  
ruby install directory is D:\Program files\ruby). Is there any better  
way of getting extensions to work under windows?

The ruby.h file is present at D:/Program  
files/ruby/lib/ruby/1.8/i386-mswin32.

thanks,  
Sriyansa

---

<div class="post-metadata">

**Author:** ![Sriyansa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@Sriyansa](https://www.ruby-forum.com/u/Sriyansa)\
**Post date:** [January 25, 2006, 4:55am UTC](https://www.ruby-forum.com/t/problems-compiling-ruby-extension-in-msvc/96973/2 "2006-01-25T04:55:57Z")

</div>

> It seems that the compiler does not like spaces in  
> the include path (My ruby install directory is  
> D:\Program files\ruby).

Try wrapping the path in quotes for example:

“D:\Program files\ruby”

Jussi Jumppanen  
Author: Zeus for Windows Ruby IDE  
[http://www.zeusedit.com](http://www.zeusedit.com)

---

<div class="post-metadata">

**Author:** ![Sriyansa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@Sriyansa](https://www.ruby-forum.com/u/Sriyansa)\
**Post date:** [January 27, 2006, 3:59pm UTC](https://www.ruby-forum.com/t/problems-compiling-ruby-extension-in-msvc/96973/3 "2006-01-27T15:59:32Z")

</div>

> It seems that the compiler does not like spaces in the include path (My  
> ruby install directory is D:\Program files\ruby).

I too have spaces in my include path, and it works ok. I thought I had  
to  
surround the path with "-signs, but for the SET commands they created  
trouble.

So I run:

ruby extconf.rb -with-ruby-include=“C:\ruby\src\ruby-1.8.2;C:\Program  
Files\Microsoft Visual Studio .NET 2003\Vc7\include;C:\Program  
Files\Microsoft Platform SDK\Include;”

set INCLUDE=C:\Program Files\Microsoft Visual Studio .NET  
2003\Vc7\include;C:\Program Files\Microsoft Platform SDK\Include;  
set LIB=C:\Program Files\Microsoft Visual Studio .NET  
2003\Vc7\lib;C:\Program Files\Microsoft Platform SDK\Lib
