Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Patrick Doyle" To: "Latyr Jean-Luc FAYE" , "Cygwin" Subject: RE: Compiling with Borland C but not with Cygwin !!! Date: Thu, 5 Apr 2001 13:21:13 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <027401c0bdf0$dd0a14c0$99face88@dcu.ie> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 Don't place -lm at the beginning of the command line. Place it at the end. --wpd > -----Original Message----- > From: cygwin-owner AT sources DOT redhat DOT com > [mailto:cygwin-owner AT sources DOT redhat DOT com]On Behalf Of Latyr Jean-Luc FAYE > Sent: Thursday, April 05, 2001 12:53 PM > To: Cygwin > Subject: Compiling with Borland C but not with Cygwin !!! > > > Hi > > That's me again. I just try to compile the file with Borland C++ and it's > working !!! > Any clue why it's not working with Cygwin > Other program are well compile by both compiler. > ???? > > I am trying to compile a C program under Cygwin with gcc but I got errors. > My configuration is : > Laptop Compaq serie 1200 Model 12XL222 > 56Mo RAM (64-8 for Video) > HD 6Go split in 2 partitions 4Go and 2Go > OS : Windows 98 SE > My file is in the 2Go partition and Cygwin as well > > Can somebody tell me what's wrong. > > Regards > Jean-Luc > > > Here is the error > latyr AT LATYR /cygdrive/d/allprogs > $ gcc -lm -otest.exe image1.c > /cygdrive/c/WINDOWS/TEMP/ccobIwme.o(.text+0x4bc):image1.c: multiple > definition of `main' > /usr/lib/libm.a(libcmain.o)(.text+0x0):libcmain.c: first defined here > /usr/lib/libm.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference to > `WinMain AT 16' > collect2: ld returned 1 exit status > > latyr AT LATYR /cygdrive/d/allprogs > $ > > Here is my code > #include > #include > > > #define N 8 > #define M 8 > #define pi 3.141592654 > #define coeff 0.707106781 > > > static double block1[M][N]={ > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}}; > > static double block2[M][N]={ > { 0, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}, > {255, 255, 255, 255, 255, 255, 255, 255}}; > > static double block3[M][N]={ > {255, 255, 255, 255, 255, 255, 255, 255}, > { 0, 0, 0, 0, 0, 0, 0, 0}, > {255, 255, 255, 255, 255, 255, 255, 255}, > { 0, 0, 0, 0, 0, 0, 0, 0}, > {255, 255, 255, 255, 255, 255, 255, 255}, > { 0, 0, 0, 0, 0, 0, 0, 0}, > {255, 255, 255, 255, 255, 255, 255, 255}, > { 0, 0, 0, 0, 0, 0, 0, 0}}; > > /******************************************************** > * void dct(double forward[M][N], double DCT[M][N]) * > * Forward Discrete Cosine Transform of MxN array * > * Parameters : * > * forward - MxN array of data to transform * > * DCT - MxN array of transformed data * > ********************************************************/ > void dct(double forward[M][N], double DCT[M][N]) > { > int u, v; /* Frequency domain variables */ > int x, y; /* Spatial domain variables */ > double accum; /* Accumulator */ > double twoN; /* 2 times N */ > double twoM; /* 2 times M */ > double scale; /* 2/square_root(MN) */ > > twoN=2.0*N; > twoM=2.0*M; > scale=(2.0/(sqrt((double)(M*N)))); > > for(u=0; u for(v=0; v { > accum=0.0; > for(x=0; x for(y=0; y accum+=(cos((pi*u*(2*x+1))/twoM)* > cos((pi*v*(2*y+1))/twoN)*forward[x][y]); > accum*=scale; > if(u==0) > accum*=coeff; > if(v==0) > accum*=coeff; > > DCT[u][v]=accum; > } > } > > /******************************************************** > * void inv_dct(double DCT[M][N], double inverse[M][N]) * > * Inverse Discrete Cosine Transform of MxN array * > * Parameters : * > * DCT - MxN array of data for inverse transform * > * inverse - MxN array of inversed transformed data* > ********************************************************/ > void inv_dct(double DCT[M][N], double inverse[M][N]) > { > int u, v; /* Frequency domain variables */ > int x, y; /* Spatial domain variables */ > double accum; /* Accumulator */ > double twoN; /* 2 times N */ > double twoM; /* 2 times M */ > double scale; /* 2/square_root(MN) */ > double Cu, Cv; /* C(u) and C(v) */ > > twoN=2.0*N; > twoM=2.0*M; > scale=(2.0/(sqrt((double)(M*N)))); > > for(x=0; x for(y=0; y { > accum=0.0; > for(u=0; u for(v=0; v { > if(u==0) > Cu=coeff; > else > Cu=1.0; > if(v==0) > Cv=coeff; > else > Cv=1.0; > > accum+=(Cu*Cv*cos((pi*u*(2*x+1))/twoM)* > cos((pi*v*(2*y+1))/twoN)*DCT[u][v]); > } > inverse[x][y]=accum*scale; > } > } > > > > > > > /***************************************************************** > ********** > * MAIN Function * > ****************************************************************** > ********** > / > int main() > { > > double dct_result[M][N], inv_dct_result[M][N]; > int i, j; > > /*** Set a 2-step loop to init the result matrix ***/ > for(i=0;i for(j=0;j dct_result[i][j]=inv_dct_result[i][j]=0.0; > > printf("\n\t******************************"); > printf("\n\t***** Block 1 **********"); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",block1[i][j]); > } > printf("\n"); > > printf("\n\t***** FORWARD DCT **********"); > dct(block1, dct_result); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",dct_result[i][j]); > } > printf("\n"); > printf("\n\t***** INVERSE DCT **********"); > inv_dct(dct_result, inv_dct_result); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",inv_dct_result[i][j]); > } > printf("\n"); > printf("\n\t******************************"); > > > /*** Set a 2-step loop to init the result matrix ***/ > for(i=0;i for(j=0;j dct_result[i][j]=inv_dct_result[i][j]=0.0; > > printf("\n\t******************************"); > printf("\n\t***** Block 2 **********"); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",block2[i][j]); > } > printf("\n"); > printf("\n\t***** FORWARD DCT **********"); > dct(block2, dct_result); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",dct_result[i][j]); > } > printf("\n"); > printf("\n\t***** INVERSE DCT **********"); > inv_dct(dct_result, inv_dct_result); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",inv_dct_result[i][j]); > } > printf("\n"); > printf("\n\t******************************"); > > /*** Set a 2-step loop to init the result matrix ***/ > for(i=0;i for(j=0;j dct_result[i][j]=inv_dct_result[i][j]=0.0; > > printf("\n\t******************************"); > printf("\n\t***** Block 3 **********"); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",block3[i][j]); > } > printf("\n"); > printf("\n\t***** FORWARD DCT **********"); > dct(block3, dct_result); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",dct_result[i][j]); > } > printf("\n"); > printf("\n\t***** INVERSE DCT **********"); > inv_dct(dct_result, inv_dct_result); > for(i=0;i { > printf("\n"); > for(j=0;j printf("\t%df",inv_dct_result[i][j]); > } > printf("\n"); > printf("\n\t******************************"); > > return 0; > } > > > --- > Latyr Jean-Luc FAYE > http://faye.cjb.net > > > > > -- > Want to unsubscribe from this list? > Check out: http://cygwin.com/ml/#unsubscribe-simple > -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple