2011-10-19 3 views
2

En utilisant Microsoft Visual C++ je suis en train de compiler le fichier « test.cc », qui fait partie d'un petit paquet disponible en téléchargement gratuit àVisual C++ erreur LNK2019

http://sourceforge.net/projects/clippoly/files/

Le test.cc de fichier apparaît comme suit:

// nclip: a polygon clip library 

// Copyright (C) 1993 University of Twente 

// [email protected] 

// This library is free software; you can redistribute it and/or 
// modify it under the terms of the GNU Library General Public 
// License as published by the Free Software Foundation; either 
// version 2 of the License, or (at your option) any later version. 

// This library is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
// Library General Public License for more details. 

// You should have received a copy of the GNU Library General Public 
// License along with this library; if not, write to the Free 
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 

#include <cstring> 
#include <iostream> 

#include "poly.h" 
#include "poly_io.h" 
#include "nclip.h" 

using namespace ::std; 

void 
clear(PolyPList &l) 
{ 
    PolyPListIter i(l); 
    while(i()) 
     delete i.val(); 
} 

int 
main(int, char *[]) 
{ 
    Poly *a = read_poly(cin), *b = read_poly(cin); 
    PolyPList a_min_b, b_min_a, a_and_b; 

    clip_poly(*a, *b, a_min_b, b_min_a, a_and_b); 

    cout << "a_min_b:\n" << a_min_b; 
    cout << "b_min_a:\n" << b_min_a; 
    cout << "a_and_b:\n" << a_and_b; 

    delete a; 
    delete b; 

    clear(a_min_b); 
    clear(b_min_a); 
    clear(a_and_b); 

    return 0; 
} 

Le fichier de test est conçu pour démontrer le calcul de l'intersection de deux polygones d'entrée.

J'ai inclus les chemins d'accès aux fichiers d'en-tête nécessaires dans 'Projet-> Propriétés-> Répertoires VC++-> Inclure les répertoires' et le compilateur reconnaît l'existence de "poly.h", "poly_io.h" et "nclip .h ".

mais quand j'essaie compiler je reçois les erreurs de l'éditeur de liens suivants:

test.obj: erreur LNK2019: symbole externe non résolu "private: __thiscall PolyNode::~PolyNode(void)" (?? 1PolyNode @@ @ XZ AAE) référencé dans la fonction "private: void * __thiscall PolyNode:: scalaire suppression destructor '(unsigned int) "` (?? _ GPolyNode @@ AAEPAXI @ Z)

test.obj: erreur LNK2019: symbole externe non résolu "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class Set<class Poly *> const &)" (?? 6 @ YAAAV? $ basic_ostream @ DU? $ char_traits @ D @ std @@@ std @@ AAV01 @ ABV? $ Set @ PAVPoly @@@@@ Z) référencé dans la fonction _main

test.obj: erreur LNK2019: symbole externe non résolu "void __cdecl clip_poly(class Poly const &,class Poly const &,class Set<class Poly *> &,class Set<class Poly *> &,class Set<class Poly *> &)" (? Clip_poly @@ YAXABVPoly @@ 0AAV $ Set @ PAVPoly @@@@ 11 @ Z) référencé en fonction _main

test.obj: erreur LNK2019: symbole externe non résolu "class Poly * __cdecl read_poly(class std::basic_istream<char,struct std::char_traits<char> > &)" (? read_poly @@ YAPAVPoly @@ AAV? $ basic_istream @ DU? $ char_traits @ D @ std std @@@ @@@ Z) référencé en fonction _main

Qu'est-ce que je fais mal? J'ai essayé d'ajouter des chemins partout dans 'Projet-> Propriétés'. Mais maintenant je suis à perte.

J'espère que cela est une question assez simple pour quelqu'un :)

Répondre

3

Il semble que vous avez dit au compilateur où les fichiers d'en-tête sont, mais pas dit l'éditeur de liens où il peut trouver la bibliothèque qui contient le Poly classe. Je n'ai pas Visual Studio devant moi, donc le chemin suivant à travers l'interface peut ne pas être sur place, mais de la mémoire, vous devez ajouter la bibliothèque (.lib) à travers Project-> Properties-> Linker- > Entrée-> Dépendances supplémentaires.

+0

+1 Vous vous êtes souvenu du chemin correctement. –