From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gaedke To: "Matthew J. Doller" Cc: gsl-discuss Subject: Re: stupid question Date: Wed, 19 Dec 2001 13:20:00 -0000 Message-id: <3C040214.7A1A14A1@uni-koeln.de> References: <1006893998.25374.4.camel@mrburns> X-SW-Source: 2001/msg00739.html Here is the code... It is changed a little bit, in order to reflect a compilable program. Do not execute it! #include #include gsl_matrix * matrix_return_upper ( gsl_matrix *m ){ int num_rows, num_cols; gsl_matrix * return_matrix; num_rows = m->size1; num_cols = m->size2; return_matrix = gsl_matrix_alloc ( num_rows , num_cols ); return (gsl_matrix *) return_matrix; } int main () { (void*)matrix_return_upper((gsl_matrix*)NULL); return 0; } it does compile without problems under redhat7.2 and under gsl-1.0 with gcc-3.0.2. Maybe you come from c++ and are new to c - like me. Be careful: Declarations have to be done before using the variables. Yours, Achim "Matthew J. Doller" schrieb: > > can someone shed a tiny bit of light on why this seemingly simple > routine is not compiling for me? > > --- BEGIN CODE --- > > #include "matrix-generic.h" > #include > #include > > gsl_matrix * matrix_return_upper ( gsl_matrix *m ){ > > int num_rows, num_cols, error; > > num_rows = m->size1; > num_cols = m->size2; > > gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols ); > > ... > ... > > return (gsl_matrix *) return_matrix; > } > > --- END CODE --- > > compile command: > gcc -o mytest matrix-generic.c -lgsl -lgslcblas -lm > > compile errors: > matrix-generic.c: In function `matrix_return_upper': > matrix-generic.c:30: parse error before `*' > > the * in question is from the line: > gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols ); > > for now, i have stripped out all the rest of the code after that line to > simplify debugging. please tell me that i'm over looking something > simple. > > thanks in advance > matt > > -- > Matthew J. Doller > mdoller@wpi.edu > http://www.wpi.edu/~mdoller From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28247 invoked by alias); 27 Nov 2001 21:14:10 -0000 Mailing-List: contact gsl-discuss-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sources.redhat.com Received: (qmail 28127 invoked from network); 27 Nov 2001 21:14:08 -0000 Received: from unknown (HELO Octopussy.MI.Uni-Koeln.DE) (134.95.166.20) by hostedprojects.ges.redhat.com with SMTP; 27 Nov 2001 21:14:08 -0000 Received: from uni-koeln.de (Octopussy [134.95.166.20]) by Octopussy.MI.Uni-Koeln.DE (8.9.1/8.9.1) with ESMTP id WAA11557; Tue, 27 Nov 2001 22:14:04 +0100 (MET) Message-ID: <3C040214.7A1A14A1@uni-koeln.de> Date: Tue, 20 Nov 2001 02:00:00 -0000 From: Achim Gaedke X-Mailer: Mozilla 4.78 [de] (X11; U; Linux 2.4.16 i586) X-Accept-Language: de-DE, en MIME-Version: 1.0 To: "Matthew J. Doller" CC: gsl-discuss Subject: Re: stupid question References: <1006893998.25374.4.camel@mrburns> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2001-q4/txt/msg00063.txt.bz2 Message-ID: <20011120020000.g0Q0PN44VdsEHmJF4TqCtEIESpo_DwsiR5WRjgm7l5Q@z> Here is the code... It is changed a little bit, in order to reflect a compilable program. Do not execute it! #include #include gsl_matrix * matrix_return_upper ( gsl_matrix *m ){ int num_rows, num_cols; gsl_matrix * return_matrix; num_rows = m->size1; num_cols = m->size2; return_matrix = gsl_matrix_alloc ( num_rows , num_cols ); return (gsl_matrix *) return_matrix; } int main () { (void*)matrix_return_upper((gsl_matrix*)NULL); return 0; } it does compile without problems under redhat7.2 and under gsl-1.0 with gcc-3.0.2. Maybe you come from c++ and are new to c - like me. Be careful: Declarations have to be done before using the variables. Yours, Achim "Matthew J. Doller" schrieb: > > can someone shed a tiny bit of light on why this seemingly simple > routine is not compiling for me? > > --- BEGIN CODE --- > > #include "matrix-generic.h" > #include > #include > > gsl_matrix * matrix_return_upper ( gsl_matrix *m ){ > > int num_rows, num_cols, error; > > num_rows = m->size1; > num_cols = m->size2; > > gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols ); > > ... > ... > > return (gsl_matrix *) return_matrix; > } > > --- END CODE --- > > compile command: > gcc -o mytest matrix-generic.c -lgsl -lgslcblas -lm > > compile errors: > matrix-generic.c: In function `matrix_return_upper': > matrix-generic.c:30: parse error before `*' > > the * in question is from the line: > gsl_matrix * return_matrix = gsl_matrix_alloc ( num_rows , num_cols ); > > for now, i have stripped out all the rest of the code after that line to > simplify debugging. please tell me that i'm over looking something > simple. > > thanks in advance > matt > > -- > Matthew J. Doller > mdoller@wpi.edu > http://www.wpi.edu/~mdoller