嘿,我正在尝试在 c++/cli 中对我的程序进行多线程处理,但是在创建我使用的代码的线程时遇到了问题:
private: Void startThread() {
MoveProj.Velocity = Variables.Velocity;
MoveProj.ProjectilePos = Projectile1.ProjectilePos;
Thread^ MotionThread1 = gcnew Thread(gcnew ParameterizedThreadStart(MoveProj, MotionThread::MoveProjectile));
Thread^ MainThread = gcnew Thread(gcnew ThreadStart());
}
但我得到了错误
Error 44 error C3350: 'System::Threading::ParameterizedThreadStart' : a delegate constructor expects 2 argument(s) c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 344
Error 89 error C3350: 'System::Threading::ParameterizedThreadStart' : a delegate constructor expects 2 argument(s) c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 344
Error 45 error C3350: 'System::Threading::ThreadStart' : a delegate constructor expects 2 argument(s) c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 345
Error 90 error C3350: 'System::Threading::ThreadStart' : a delegate constructor expects 2 argument(s) c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 345
Error 43 error C3867: 'MotionThread::MoveProjectile': function call missing argument list; use '&MotionThread::MoveProjectile' to create a pointer to member c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 344
Error 88 error C3867: 'MotionThread::MoveProjectile': function call missing argument list; use '&MotionThread::MoveProjectile' to create a pointer to member c:\users\gaz\documents\visual studio 2012\projects\projectilemotion\projectilemotion\Simulation.h 344
对此的任何帮助都会有很大帮助,因为它对我的大学(我认为是美国的英国大四)计算项目和我的导师希望它在相对较快的时间内完成。