Problems using GNU Scientific Library in Visual Studio 2012

Refresh

December 2018

Views

429 time

2

I'm having some issues trying to install GSL for my programming course at uni (the course is taught in C). I'm using Visual Studio express 2012.

I've downloaded and run a precompiled GSL thing (GnuWin32) and changed my Linker and Includes options in VS, and the code is actually running properly. I've been using the following code as an example:

#include <math.h>
#include <stdio.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>

int main()
{
  size_t i,j;

  gsl_matrix *m;
  m = gsl_matrix_alloc (10, 10);

  for (i = 0; i < 10; i++)
  {
    for (j = 0; j < 10; j++)
    {
      gsl_matrix_set (m, i, j, sin (i) + cos (j));
    }
  }

  for (j = 0; j < 10; j++)
  {
    gsl_vector_view column = gsl_matrix_column (m, j);
    double d;

    d = gsl_blas_dnrm2 (&column.vector);

    printf ("matrix column %d, norm = %g\n", j, d);
  }

  gsl_matrix_free(m);
}

This is running properly and giving me the correct output. However, when VS gets to the final curly bracket, it freaks out and gives me this error message:

"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

Does anyone have an idea how to stop this happening? I've scoured the internet, and haven't found anything useful that I can understand.

1 answers

0

«ESP не был сохранен правильно» звучит как стандартный код ASM, чтобы сохранить ESP в EBP не удалась или не была сгенерирована. Существует опция компилятора "Опустить кадры указателей. Проверьте, как это установлено в вашей сборке как для библиотеки и основного кода. Они оба должны быть построены таким же образом. Кроме того, если вы хотите отладчик к работе, то отключите эту опцию.

DNT