2013-07-03 56 views
1

我正在使用MS Visual Studio 2010專業版的C++/CLI(Visual C++)項目。我有一個叫做SRecognizer的類,它使用了一些C#庫。現在,它具有以下代碼'系統::線程:: ThreadStart':錯誤

r = gcnew RTMotionDetector(); 

Thread ^detectionThread = gcnew Thread(gcnew System::Threading::ThreadStart(this,&r->start())); 

RMotionDetector類的頭低於

#pragma once 
#include "MotionDetector.h" 

ref class RTMotionDetector : 
    public MotionDetector 
{ 
public: 
    RTMotionDetector(void); 
    ~RTMotionDetector(void); 
    void start(); 
    void pause(); 
    void stop(); 

private: 
    VideoCapture *cam1; 
}; 

當程序運行時,它提供了以下錯誤

1>------ Build started: Project: Automated Intruder Tracking System, Configuration: Debug Win32 ------ 
1>Build started 7/3/2013 1:03:49 PM. 
1>InitializeBuildStatus: 
1> Touching "Debug\Automated Intruder Tracking System.unsuccessfulbuild". 
1>GenerateTargetFrameworkMonikerAttribute: 
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files. 
1>ClCompile: 
1> All outputs are up-to-date. 
1> SRecognizer.cpp 
1>SRecognizer.cpp(38): error C2102: '&' requires l-value 
1>SRecognizer.cpp(38): error C3350: 'System::Threading::ThreadStart' : a delegate constructor expects 2 argument(s) 
1> 
1>Build FAILED. 
1> 
1>Time Elapsed 00:00:02.19 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

正如你所看到的,錯誤在於我如何創建SRecognizer中的線程,您已經擁有上面的特定代碼。我對C++/CLI相當陌生,請幫忙。

+0

你已經糾正缺少 「)」 的錯誤?這一點很明顯。它會改變什麼嗎? – JeffRSon

+0

@JeffRSon:非常感謝您的回覆。我糾正了這個問題。現在丟失的l值和其他錯誤仍然存​​在 –

回答

1

這應該可以解決的編譯器錯誤:

Thread^ detectionThread = gcnew Thread(gcnew System::Threading::ThreadStart(r, &RTMotionDetector::start)); 
+0

非常感謝!它解決了這個問題! –