Question

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 à

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

//    klamer@mi.el.utwente.nl

//    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-> VC ++ Directories-> Inclure des répertoires » et le compilateur reconnaît l'existence de « poly.h », « poly_io.h » et « nclip. h ».

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

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::scalar 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é dans la fonction _main

test.obj: erreur LNK2019: non résolue "class Poly * __cdecl read_poly(class std::basic_istream<char,struct std::char_traits<char> > &)" symbole externe (?? 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 dans tous les sens sous la rubrique « Projet-> Propriétés ». Mais maintenant, je suis à une perte.

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

Était-ce utile?

La solution

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 la classe Poly.

Je n'ai pas Visual Studio en face de moi si l'itinéraire suivant à travers l'interface peut-être pas sur place, mais de mémoire vous devez ajouter la bibliothèque (.lib) par Projet-> Propriétés-> Linker-> > entrées- dépendances supplémentaires.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top