This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Simple stuff: return values


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I'm testing out GSL to see if it would be any benefit here where I work,
since we have some grad students that occasionally need access to
functions for things like random number distributions.

Since many of the people who would be using it are not programming for a
living, I thought I'd try to see how hard it was to write a simple
program.  I wrote this small chunk of code, which seemed easy enough
(especially since I'm not exactly a guru when it comes to mathematics ;-)

#include <stdio.h>
#include <gsl/gsl_complex.h>

int
main (int argc, char *argv[])
{
  gsl_complex a;

  a = gsl_complex_xy (1, 1);

  printf ("%f + %fi\n", GSL_REAL (a), GSL_IMAG (a));

  return 0;
}

I tried to compile it, but I was a bit perplexed to see this error:

$ gcc gsl_test.c `gsl-config --cflags` `gsl-config --libs`
gsl_test.c: In function `main':
gsl_test.c:9: incompatible types in assignment

So, I get the feeling that there's a little trick I'm missing (or maybe I
just left my programming brain at home today)....

- -- 
         Mike Hicks   [mailto:mhicks@csom.umn.edu]
   Unix Support Assistant     |  Carlson School of Management
Office: 4-214  Phone: x67909  |     University of Minnesota
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6rTyl05OjzVUnj0URAhSAAKCZjWhtI9zeWJKoHZ/jx2qp8Fq61wCdFT1P
0B/MkuBlrPE9wrXQK1cIp3g=
=aRMI
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]