Skip to content

Instantly share code, notes, and snippets.

@ntmoe
Created January 28, 2013 04:16
Show Gist options
  • Select an option

  • Save ntmoe/4652970 to your computer and use it in GitHub Desktop.

Select an option

Save ntmoe/4652970 to your computer and use it in GitHub Desktop.
Minimal example to get warnings about gsl_vector_get and gsl_vector_set when building freesteam-2.1 on OS X 10.8.2
#include <stdio.h>
#include <gsl/gsl_vector.h>
static int region1_f(const gsl_vector *x);
int main (void)
{
gsl_vector * x = gsl_vector_alloc (3);
int i;
for (i = 0; i < 3; i++)
{
gsl_vector_set (x, i, 1.234 + i);
}
region1_f(x);
return 0;
}
static int region1_f(const gsl_vector *x){
double p = gsl_vector_get(x,0);
double T = gsl_vector_get(x,1);
printf("%f\n", p);
printf("%f\n", T);
return GSL_SUCCESS;
}
@ntmoe
Copy link
Author

ntmoe commented Jan 28, 2013

There are no messages to stdout when using
$ gcc main.c -o gsl_test pkg-config gsl --libs --cflags``
but I get the warnings when I do this, which is taken from the command executed by scons:

$ gcc -o solver2.os -c -Wall -W -Wconversion -Wimplicit -fPIC -D_REENTRANT -I/usr/local/Cellar/gsl/1.15/include main.c
main.c: In function ‘main’:
main.c:16: warning: passing argument 1 of ‘gsl_vector_alloc’ with different width due to prototype
main.c:21: warning: passing argument 2 of ‘gsl_vector_set’ with different width due to prototype
main.c:27: warning: control reaches end of non-void function
main.c: In function ‘region1_f’:
main.c:30: warning: passing argument 2 of ‘gsl_vector_get’ with different width due to prototype
main.c:31: warning: passing argument 2 of ‘gsl_vector_get’ with different width due to prototype

... and the program runs fine:

$ ./gsl_test 
1.234000
2.234000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment