2011-05-16 72 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++代碼的問題。

相關問題