Hello community. I am writing a program that will use multiple threads to run MATLAB functions inside of Cpp by using the MATLAB compiler to create a DLL. I have already written the MATLAB DLL and I have everything linked up just fine, but now I need to split this program into multiple threads (one for 'real time' data collection and the other for 'signal smoothing'). I have been told by my boss man that I need to use cWinThread (worker threads) in order to do this. I was wondering if anyone could tell me how to interface with the MFC libraries in my console application?
here is my preprocessor:
#include <cstdio>
#include "procSinkLib.h"
//#include <afx.h> why can't I include this without errors?
when I try to #include afx.h so that I can build threads via AfxBeginThread I get the following error:
afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
well fine... so I go into afxv_w32.h and comment out windows.h... no dice It still throws the error.
here is what I'm attempting to put into a thread:
//the thread that eats processor
int callProcessThread(void){
double mins = 0;
std::cout << "How many minutes? ";
std::cin >> mins;
mxDouble flips(-1.);
int nlhs = 4, nrhs = 4;
mwArray output(1,1,mxDOUBLE_CLASS, mxREAL);
mwArray input(1,1,mxDOUBLE_CLASS,mxREAL);
mxDouble mxMin(mins);
input.SetData(&mxMin,1);
//this guy needs to go into a cWinThread worker thread...
procsink(1, output, input);
output.GetData(&flips,1);
std::cout << "Inversions: " << flips << std::endl;
return 0;
}
any ponters or help would be greatly appreciated. Thank you for your time.