The MinGW compiler is required to compile the C function and
creates a .dll file on Windows.
just issue the following command in a command window:
Rcmd SHLIB yourfile.c
Q1:是在开始中运行"cmd"进入 command prompt ?
对
Q2:Rtools装在"G:\Program Files\Rtools\"..
主要是检测路径是否设置正确
请先执行
c:\>gcc --help
若成功,你可看到a list of options.
有问题请告知
Q3:
用NOTEPAD把下列这段存成matprod1.c
/* File: matprod1.c */
/* Calculates the product of two matrices X and Y */
void matprod1(double *X, int *nrX, int *ncX,
double *Y, int *nrY, int *ncY, double *ans)
{
double sum;
int ii, jj, kk;
for (ii=0; ii<*nrX; ii++){
for (jj=0; jj<*ncY; jj++){
sum = 0;
for (kk=0; kk<*ncX; kk++){
sum = sum + X[ii+*nrX*kk]*Y[kk+*nrY*jj];
}
ans[ii+*nrX*jj] = sum;
}
}
}
文档中说"The compiler must be on your computers path. " "In that case, the path to the MinGW compiler must appear before that to cygwin in your
search path."
right click on the "My Computer" icon on desktop
Choose properties
click on the “advanced" tab
Click the environmental variables button
select“system variable" "path"
select the edit button
在最后面;
加入G:\Program Files\mingw\bin;
(请自行再检查一次,必须完全正确)