arch下安装MinGW
yaourt -S mingw32-binutils mingw32-gcc mingw32-runtime |
会生成对应的编译工具,在我的本本上是:
i486-mingw32-gcc i486-mingw32-g++
代码:
#include <stdio.h>
int swap_add(int *xp, int *yp)
{
int x = *xp;
int y = *yp;
*xp = y;
*yp = x;
return x + y;
}
int caller()
{
int arg1 = 1;
int arg2 = 2;
int sum = swap_add(&arg1, &arg2);
int diff = arg1 - arg2;
printf("swap_add: %d\n", sum);
return sum * diff;
}
int main()
{
printf("caller: %d\n", caller());
return 0;
}
|
编译:
i486-mingw32-gcc -o swap_add.exe swap_add.c |
运行:
结果:
阅读(1407) | 评论(0) | 转发(0) |