Trying to multithread program. C++/CLI

Hey i'm trying to multithread my program in c++/cli but i'm having problems with creating the threads the code im using is:

1
2
3
4
5
6
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());
 }


but i'm getting the errors

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


any help with this would be a great help as its for my college(British so senior year for americans i think) computing project and my tutor wants it in relatively soon.
Last edited on
The error messages are clear enough, Constructors you are calling as for example 'System::Threading::ParameterizedThreadStart' or 'System::Threading::ThreadStart' require that to be specified 2 arguments
Yea but on the parametisedthreadstart I have 2 arguments and its LL hrowing up that error. I've tried all of the Microsoft examples just modified for my code and well none of it works. Obviously its something wrong with the way im coding it but I can't figure it out. But thankyou for replying :P
At last I do nt see that ThreadStart has two arguments

hread^ MainThread = gcnew Thread(gcnew ThreadStart());
well no Threadstart dosn't atm. but the paramtisedThreadStart does and is still giving the same error so i'm obviously doing something wrong but i can't figure it out.

https://gist.github.com/welsh4evr/5365988

Thats most of my code i wrote everything in .h files instead of .cpp files but i don't think it makes much difference. the .cpp files are pretty much empty apart from a few #includes
Last edited on
Topic archived. No new replies allowed.