注册 登录
编程论坛 Matlab

[求助] VC++中调用了Matlab C++函数是不是会冲突啊???????

xy_nuaa 发布于 2006-05-17 22:14, 995 次点击

各位高手:

由于需要矩阵的运算,我的程序中调用了“matlab.hpp”头文件,结果我用C++的rand()函数产生随机数的时候总产生错误,程序如下:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "matlab.hpp"
int main( void )
{
int i;

srand( (unsigned)time( NULL ) );
for (i = 0; i < 10; i++ )
{
int rand100=rand()%100;
printf( " %6d\n", rand100);
}

}

产生错误如下:error C2676: binary '%' : 'class mwArray' does not define this operator or a conversion to a type acceptable to the predefined operator



这是什么原因啊,请各位高手指点,万分感谢!!!!!!!!!

0 回复
1