为什么相同的程序在不同的编译器一个能编译 一个不能
这是我的程序 在win——tc能编译 在lcc-win32不能编译成功
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
#include "math.h"
main()
{
double i;
int x,y;
char a,b;
char *c;
char d[20],h[20];
int *Data;
FILE *fp,*fp2;
fp=fopen("c:\\green1.mif","wt+");
fp2=fopen("d:\\green.bmp","rb");
Data=(int *)malloc(460800*sizeof(int));
memset(Data,0,460800);//将pColorData[heigth*1_width]清零
fseek(fp2,54,SEEK_SET) ;
//把位图数据信息读到数组里
fread(Data,sizeof(char),460800,fp2);
c="-- Copyright (C) 1991-2005 Altera Corporation\n";
fprintf(fp,c);
c="-- Your use of Altera Corporation's design tools, logic functions\n";
fprintf(fp,c);
c="-- and other software and tools, and its AMPP partner logic\n";
fprintf(fp,c);
c="-- functions, and any output files any of the foregoing\n";
fprintf(fp,c);
c="-- (including device programming or simulation files), and any\n";
fprintf(fp,c);
c="-- associated documentation or information are expressly subject\n";
fprintf(fp,c);
c="-- to the terms and conditions of the Altera Program License\n";
fprintf(fp,c);
c="-- Subscription Agreement, Altera MegaCore Function License\n";
fprintf(fp,c);
c="-- Agreement, or other applicable license agreement, including,\n";
fprintf(fp,c);
c="-- without limitation, that your use is for the sole purpose of\n";
fprintf(fp,c);
c="-- programming logic devices manufactured by Altera and sold by\n";
fprintf(fp,c);
c="-- Altera or its authorized distributors. Please refer to the\n";
fprintf(fp,c);
c="-- applicable agreement for further details.\n\n";
fprintf(fp,c);
c="-- Quartus II generated Memory Initialization File (.mif)\n\n";
fprintf(fp,c);
c="WIDTH=8;\nDEPTH=921600;\n\nADDRESS_RADIX=DEC;\nDATA_RADIX=HEX;\n\nCONTENT BEGIN\n";
fprintf(fp,c);
for(i=0;i<460800;i++)
{
fprintf(fp,"\t");
x=i;
itoa(x,d,10);
fprintf(fp,d);
fprintf(fp,"\t:\t");
y=Data[i];//这个Lcc——win32提示的错误:operands of +have illegal types "pointer to int "and "double"
itoa(y,h,16);
fprintf(fp,h);
fprintf( fp,";");
fprintf(fp,"\n");
}
fprintf(fp,"END;\n");
fclose(fp);
printf("\n\t\tcreate mif.mif successfully!\n\n\tpress any key to exit!");
getch();
exit(0);
}
[ 本帖最后由 xiaosongshu 于 2011-9-1 15:16 编辑 ]