Pregunta

Usando Microsoft Visual C ++ estoy tratando de compilar el archivo "Test.cc" que forma parte de un paquete pequeño disponible para descargar gratuita en

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

El archivo test.cc aparece de la siguiente manera:

//    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;
}

El archivo de prueba está diseñado para demostrar el cálculo de la intersección de dos polígonos de entrada.

He incluido rutas a los archivos de encabezado necesarios en 'Project-> Properties-> VC ++ Directorios-> Incluir directorios' y el compilador reconoce la existencia de "Poly.h", "Poly_io.h" y "Nclip.h".

Sin embargo, cuando intento compilar, recibo los siguientes errores de enlazador:

Test.obj: Error LNK2019: símbolo externo no resuelto "private: __thiscall PolyNode::~PolyNode(void)" (?? 1Polynode @@ aae@xz) referenciado en la función "private: void * __thiscall PolyNode::Escalar eliminando destructor '(unsigned int) "` (?? _ gpolynode @@ aaepaxi@z)

Test.obj: Error LNK2019: símbolo externo no resuelto "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? $ Básico_ostream@du? $ Char_traits@d@std @@@ std @@ aav01@abv? $ Set@pavpoly @@@@ z) referenciado en función _main

Test.obj: Error LNK2019: símbolo externo no resuelto "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) referenciado en función _main

Test.obj: Error LNK2019: símbolo externo no resuelto "class Poly * __cdecl read_poly(class std::basic_istream<char,struct std::char_traits<char> > &)" (? Read_poly @@ yapavpoly @@ aav? $ básico_istream@du? $ char_traits@d@std @@@ std @@@ z) referenciado en función _main

¿Qué estoy haciendo mal? He intentado agregar rutas por todo el lugar en 'Project-> Propiedades'. Pero ahora estoy perdido.

Espero que esta sea una pregunta bastante simple para alguien :)

¿Fue útil?

Solución

Parece que le ha dicho al compilador dónde están los archivos de encabezado, pero no le han dicho al enlazador dónde puede encontrar la biblioteca que contiene el Poly clase.

No tengo Visual Studio frente a mí, por lo que la siguiente ruta a través de la interfaz puede no ser acertada, pero desde la memoria debe agregar la biblioteca (.lib) a través de Project-> Propiedades-> Linker-> Enumer-> Dependencias adicionales.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top