error LNK2019: Verweis auf nicht aufgelöstes externes Symbol

Beantwortet error LNK2019: Verweis auf nicht aufgelöstes externes Symbol

  • Dienstag, 10. Juli 2012 10:08
     
      Enthält Code

    Ich habe ein Beispielcode "tlmdif1c.c" ( aus Zip-File CMinpack von http://devernay.free.fr/hacks/cminpack/index.html) in die Quelldatei "TEST1_090712_tlmdif1c_Anzeige.cpp" meiner Win32-Konsolenanwendung eingefügt und wollte es mal laufen lassen.

    Die aufgerufenen Subroutinen "lmdif1", "enorm" sowie "dpmpar" sowie die eingebundenen Headerfiles sind ebenfalls in dem Zip-File CMinpack enthalten.

    Linker-Einstellung: Linker / System / Subsystem: "Konsole (/SUBSYSTEM:CONSOLE)"

    Die Kompilierung des Codes verläuft fehlerfrei.

    Beim Erzeugen des Projektes bekomme ich folgende Fehler:

    1>------ Erstellen gestartet: Projekt: TEST1_090712_tlmdif1c_Anzeige, Konfiguration: Debug Win32 ------

    1> TEST1_090712_tlmdif1c_Anzeige.cpp

    1>TEST1_090712_tlmdif1c_Anzeige.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__enorm" in Funktion "_wmain".

    1>TEST1_090712_tlmdif1c_Anzeige.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__lmdif1" in Funktion "_wmain".

    1>TEST1_090712_tlmdif1c_Anzeige.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__dpmpar" in Funktion "_wmain".

    1>D:\Users\debiegeir\Documents\Visual Studio 2010\Projects\TEST1_090712_tlmdif1c_Anzeige\Debug\TEST1_090712_tlmdif1c_Anzeige.exe : fatal error LNK1120: 3 nicht aufgelöste externe Verweise.

    ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

    Hier der Code dazu:

    // TEST1_090712_tlmdif1c_Anzeige.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
    //
    #include "stdafx.h"
    #include <stdio.h>
    #include <iostream>
    #include <math.h>
    #include <float.h>
    #include <D:CMinPack/CMinpack_Versionen/cminpack-1.3.0/cminpack.h>
    #include <D:CMinPack/CMinpack_Versionen/cminpack-1.3.0/cminpackP.h>
    #include <D:CMinPack/CMinpack_Versionen/cminpack-1.3.0/minpack.h>
    	
    #define real __cminpack_real__
    /* the following struct defines the data points */
    typedef struct  {
        int m;
        real *y;
    } fcndata_t;
    int fcn(void *p, int m, int n, const real *x, real *fvec, int iflag);
    int _tmain()//int argc, _TCHAR* argv[]
    {
    	int info, lwa, iwa[3];
      real tol, fnorm, x[3], fvec[15], wa[75];
      const int m = 15;
      const int n = 3;
      /* auxiliary data (e.g. measurements) */
      real y[15] = {1.4e-1, 1.8e-1, 2.2e-1, 2.5e-1, 2.9e-1, 3.2e-1, 3.5e-1,
                      3.9e-1, 3.7e-1, 5.8e-1, 7.3e-1, 9.6e-1, 1.34, 2.1, 4.39};
      fcndata_t data;
      data.m = m;
      data.y = y;
      /* the following starting values provide a rough fit. */
      x[0] = 1.;
      x[1] = 1.;
      x[2] = 1.;
      lwa = 75;
      /* set tol to the square root of the machine precision.  unless high
         precision solutions are required, this is the recommended
         setting. */
      tol = sqrt(__cminpack_func__(dpmpar)(1));
      info = __cminpack_func__(lmdif1)(fcn, &data, m, n, x, fvec, tol, iwa, wa, lwa);
      fnorm = __cminpack_func__(enorm)(m, fvec); //Definierung in "cminpackP.h"
      printf("      final l2 norm of the residuals\n\n");
      
      printf("      final l2 norm of the residuals%15.7g\n\n",(double)fnorm);
      printf("      exit parameter                %10i\n\n", info);
      printf("      final approximate solution\n\n %15.7g%15.7g%15.7g\n",
    	 (double)x[0], (double)x[1], (double)x[2]);
    	getchar(); // Zum Stoppen des Anzeigefensters
    	return 0;
    }
    int fcn(void *p, int m, int n, const real *x, real *fvec, int iflag)
    {
      /* function fcn for lmdif1 example */
      int i;
      real tmp1,tmp2,tmp3;
      const real *y = ((fcndata_t*)p)->y;
      for (i = 0; i < 15; ++i)
        {
          tmp1 = i + 1;
          tmp2 = 15 - i;
          tmp3 = (i > 7) ? tmp2 : tmp1;
          fvec[i] = y[i] - (x[0] + tmp1/(x[1]*tmp2 + x[2]*tmp3));
        }
      return 0;
    }

    Kann mir da jemand weiterhelfen an was das liegen könnte? Einbindung der Header-Files oder sonstige Pojekt-Einstellungen?

    Oder am Inhalt des Headerfiles..?

    Vielen Dank schon mal!

Alle Antworten