2011-05-16 53 views
2

我试图用Visual Studio创建单的可执行文件运行2010 设置在VS 2010中有: -C++项目 -cil纯问题在运行Visual Studio的可执行文件与单

我的最终目标是使用visual studio 2010编译Parsec基准测试,然后在windows和linux中运行单声道可执行文件。

现在我创建了一个简单的C++项目,只包含一个printf。 可执行文件运行公平与windows下单,而它给我linux下

这就是我回来的诸多问题:

** (thread.exe:1424): WARNING **: Missing method .ctor in assembly /home/chezz/Scrivania/thread.exe, type System.Runtime.CompilerServices.FixedAddressValueTypeAttribute 

** (thread.exe:1424): WARNING **: Can't find custom attr constructor image: /home/chezz/Scrivania/thread.exe mtoken: 0x0a00000d 

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for <Module> ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load. 
---> System.MissingMethodException: Method not found: 'System.AppDomain.IsDefaultAppDomain'. 
    at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport*) [0x00000] 
    --- End of inner exception stack trace --- 
    at <Module>.<CrtImplementationDetails>.ThrowModuleLoadException (System.String errorMessage, System.Exception innerException) [0x00000] 
    at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport*) [0x00000] 
    at <Module>..cctor() [0x00000] 
    --- End of inner exception stack trace --- 

任何想法? 感谢 安德烈

+0

如果你编写C++代码,为什么你要坚持编译为IL?你确定Mono运行你的程序而不是.NET框架吗? – 2011-05-16 20:27:49

+0

我被要求为我的论文工作做这种工作,为了支持多平台编译中的pthread我还用MoMA测试了可执行文件,它发送了很好的窗口反馈 – user756283 2011-05-17 09:12:03

回答

0

我的猜测是,在Visual C++编译器生成将使用MSVCRT如果调用是在C运行时函数的代码(即non-.NET,像printf)。为了能够在Linux上的Mono上运行,您应该只使用.NET框架类(例如System.Console.WriteLine用于控制台输出,而不是printf)。

0

我相信阅读Mono-C++可能会帮助你解决你的问题。关注C++支持和运行C++代码的问题。

相关问题