如何安装gcc交叉编译器

我试图在linux下安装交叉编译器时遇到困难。 我下载了一个似乎没问题的工具链,但下一步是什么? 我需要在控制台中输入哪些订单才能安装?

目的是将C代码转换为MIPS(小端)代码。

实际上我只需要一次只需2个代码,所以如果有人只能用MIPS向我展示这些代码,我会非常高兴…

第一个代码:

#include  #include  #include  #define SIZE 128 int main () { char mychar , string [SIZE]; int i; int count =0 ; printf ("Please enter your string: \n\n"); fgets (string, SIZE, stdin); printf ("Please enter char to find: "); mychar = getchar(); for (i=0 ; string[i] != '\0' ; i++ ) if ( string[i] == mychar ) count++; printf ("The char %c appears %d times\n" ,mychar ,count); return 0; } 

第二个代码:

 #include  #include  void SIFT(int x_arr[ ], int y_arr[]); int main () { int x[20] = {0} , y[20] = {0}; int m=0,temp=0,curr=0,i=0,j=0; printf("Please enter your numbers now:\n\n"); /*enter numbers one by one. if x[i+1] value = curr) { x[i] = temp; curr = temp; i++; } else { printf("The numbers are not at the right order !\n\nProgram will now terminate...\n\n"); } } SIFT(x,y); for (i=0 ; y[i]=='0' ; i++) /*strlen(y) without ('0')'s includes*/ m++; /*Prints m , y's organs*/ printf("\n\nm = %d",m); printf("Y = "); while (y[j]!='0') { printf ("%d ,",y[j]); j++; } return 0; } void SIFT(int x_arr[ ], int y_arr[]) { int i=0,j=0; while (x_arr[i] != '0') { if (x_arr[i] == x_arr[i+1]) /*if current val. equals next val. -> jump dbl at x_arr*/ { y_arr[j] = x_arr[i]; i+=2; j++; } else { y_arr[j]=x_arr[i]; i++; j++; } } } 

您可能想尝试使用crosstool-NG为您的系统构建和安装工具链。

我不确定这是否会对你有所帮助,但我已经使用ecc(http://ellcc.org)编译了你的源文件并得到了:

 http://pastebin.com/keDPEcsc 

 http://pastebin.com/zQBsMVfS 

希望有所帮助。

你需要使用工具链构建自己的版本 – 它不是一个独立的编译器,它会创建一个。 看看http://www.kegel.com/crosstool/crosstool-0.43/doc/crosstool-howto.html