views:

318

answers:

2

Hi,

I am starting to use Mono to develop applications in C# and C++. I wanted to ask you, how is Mono compiling the C++ code? is it using GCC? It is amazing to see that it has the STL containers... Also, can I use the Boost libraries and GSL libraries with Mono? Thanks in advance!!!

+5  A: 

As long as you don't need mixed mode (i.e., forget the native part and go for CIL-only), mono does work with C++ code (I hear they're now experimentally supporting mixed mode, on Windows especially, and elsewhere via wine, but I think that part's NOT ready for prime time). The one well-supported C++ compiler at this time is Microsoft C++/CLI on Net 2.x frameworks; efforts have been underway (for many years now) to add gcc, but I don't know of any production-ready result so far:-(.

Alex Martelli
+4  A: 

I think you must be using MonoDevelop, the IDE, as opposed to Mono itself.

Yes, MonoDevelop uses gcc/g++ to compile C/C++ source code, but it is not compiled to CIL - it is compiled to a native binary.

If I am understanding correctly, then you should be able to use boost just fine.

If, however, you are asking if Mono has support for Mixed-Mode assemblies or executables (e.g. assemblies/exe's that contain both native and .NET CIL), then I am sorry to inform you that this feature is not supported, nor is compiling C++ to pure CIL by Mono.

jstedfast
Yes, I am using MonoDevelop. The problem I am having is that I don't know how to link the boost libraries. If I want to include the array.hpp file, I write #include<directories/array.hpp>, but because this file makes calls to other files, and the directories to those files in the array.hpp file are "/boost/somefile", I am having some problem with the directories. What can I do?
Specifically, the directories should be /directories/boost/somefile as opposed to just /boost/somefile.
Okay, what you want to do is set up the C++ include paths. You don't want to #include </full/path/to/boost/array.hpp>, what you should do is #include <boost/array.hpp> and add /full/path/to as an include path in MonoDevelop's Project Options (under Code Generation).
jstedfast