2013-10-25 26 views
0

我嘗試開發本地進程間通信匿名管道,指這篇文章...... http://msdn.microsoft.com/en-us/library/bb546102.aspx本地進程間通信匿名管道上了openFrameworks 0.7.4 VS 2010

我把這兩條線在testApp.cpp

#using <System.dll> 
#using <System.Core.dll> 

using namespace System; 
using namespace System::IO; 
using namespace System::IO::Pipes; 
using namespace System::Diagnostics; 

void testApp::setup() { 

} 

void testApp:update() { 

} 

void testApp:draw() { 

     Process^ pipeClient = gcnew Process(); 

     pipeClient->StartInfo->FileName = "pipeClient.exe"; 

     AnonymousPipeServerStream^ pipeServer = 
      gcnew AnonymousPipeServerStream(PipeDirection::Out, 
      HandleInheritability::Inheritable); 
     // Show that anonymous pipes do not support Message mode. 
     try 
     { 
      Console::WriteLine("[SERVER] Setting ReadMode to \"Message\"."); 
      pipeServer->ReadMode = PipeTransmissionMode::Message; 
     } 
     catch (NotSupportedException^ e) 
     { 
      Console::WriteLine("[SERVER] Exception:\n {0}", e->Message); 
     } 

     Console::WriteLine("[SERVER] Current TransmissionMode: {0}.", 
      pipeServer->TransmissionMode); 

} 

,他們表現出,

"Error:"#using" requires C++/CLI to be enabled 

#using <System.dll>,因此,在項目

Properties->Configuration Properties->General->Common

語言運行庫支持,我從「沒有共同語言Runtime支持」到「Common Language Runtime Support (/clr)」改變了這個。

然後我試圖重建並得到了另一個錯誤,是

Command line error D8016: '/ZI' and '/clr' command-line options are incompatible.. 

現在,我完全失去了..

有誰有如何對0.7.4建立匿名管道的解決方案?

在此先感謝。

OpenFrameworks 0.7.4/Visual Studio 2010/compiler v100 
+1

你有沒有考慮使用波科的管道?它們在openFrameworks中可用,並且跨平臺很好地工作http://pocoproject.org/slides/150-Processes.pdf – bakercp

回答

0

謝謝您的意見!我嘗試使用它,並得到這個錯誤....

Unhandled exception at at 0x7591C41F in emptyExample_debug.exe: Microsoft C++ exception: Poco::SystemException at memory location 0x0018F740. 

我調試是這樣的代碼...

void testApp::setup(){ 

    std::string cmd("bonanza.exe"); 
    std::vector<std::string> args; 
    args.push_back("csa_shogi"); 
    Poco::Pipe outPipe; 
    ProcessHandle ph = Process::launch(cmd, args, 0, &outPipe, 0); 
    Poco::PipeInputStream istr(outPipe); 

}