CGAL 라이브러리의 일부를 사용하는 테스트 프로그램을 컴파일하는 동안 이상한 (나에게) 오류가 발생합니다.Windows에서 컴파일/링크시 CGAL 미해결 외부 참조
먼저, 환경 :
- 윈도우 7 64 비트
- 부스트 1.53
- CGAL 4.3
- Qt는 4.8.4
- CMake 2.8.10.2
- 비주얼 스튜디오 2010 전문가
- 설치 모든 라이브러리를 32 비트 용으로 편집했습니다 (설치 중에 옵션 인 경우).
설치가 잘못 되었습니까?
내 컴퓨터에 CGAL을 설치하려면이 자습서 (http://www.cgal.org/windows_installation.html)를 따르십시오. 나는 이것이 나를 위해 즉시 사용할 수 없다는 것을 여기서 주목해야한다. CMake에서 CGAL의 설정 단계 동안, 튜토리얼에 언급 된대로 대응하는 환경 변수를 설정했지만, 부스트 라이브러리는 발견되지 않았다. CMake에서 잘못된 변수를 설정 한 후 구성 및 생성 단계를 완료 할 수있었습니다. 그 후 Visual Studio에서 CGAL의 디버그 구성과 릴리스 구성을 모두 컴파일 할 수있었습니다.
CGAL lib가 성공적으로 설치되었는지 테스트하기 위해 예제와 데모를 컴파일하고 실행하려고했습니다. 이들은 또한 즉시 작동하지 않았다. 문제는 CGAL 및 부스트 헤더 (및 바이너리)가 발견되지 않았다는 것입니다. 프로젝트 속성 => 구성 속성 => C/C++ => 추가 포함 디렉터리 및 프로젝트 속성 => 구성 속성 => 링커 => 추가 라이브러리 디렉터리 예제 및 데모를 빌드 할 수 있습니다. 그 후 나는이 예제들을 성공적으로 실행했다.
실제 문제가 이제
, 나는 특정 운동 (http://acg.cs.tau.ac.il/courses/algorithmic-robotics/spring-2013/exercises/assignment-2 운동 2.1)을 만들 수 있도록하기 위해, 간단한 프로그램을 컴파일 tyring하고있다. 여기에 제공된 두 개의 파일이 있습니다 basic_typdef.h 및 cgal_bootcamp.cpp
* basic_typedef.h * * cgal_bootcamp.cpp *
#include "basic_typedef.h"
int main(int argc, char* argv[])
{
return 0;
}
#pragma once
#include <CGAL/Cartesian.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Boolean_set_operations_2/Gps_default_dcel.h>
#include <CGAL/Polygon_set_2.h>
#include <list>
/*******************************************************************************************
* This file contatins basic typedefs (from CGAL and more).
*******************************************************************************************/
typedef CGAL::Gmpq Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef Kernel::Point_2 Point;
typedef CGAL::Polygon_2<Kernel> Polygon;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes;
typedef CGAL::Polygon_set_2<Kernel> Polygon_set;
typedef std::list<Polygon_with_holes> Polygon_with_holes_container;
이 (편의를 위해 내가 제거 코멘트 파일 cgal_bootcamp.cpp에서)
위의 두 파일을 컴파일 할 수 있습니다. 그러나, 내가 Point를 만들려고 할 때 (basic_typedef에 정의 된대로.발생
#include "basic_typedef.h"
int main(int argc, char* argv[])
{
/*
1. Point
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Class_Point_2.html
*/
// Create Point with the coordinates (0.5, 0.6)
Point p;
return 0;
}
오류 : 시간), 나는 (이상한) 오류 받고 있어요 내가 뭘 잘못 여기 것입니다 단서가 없다
Error 1 error LNK2019: unresolved external symbol __imp____gmpq_init referenced in function "public: __thiscall CGAL::Gmpq_rep::Gmpq_rep(void)" ([email protected]@@[email protected]) C:\Dropbox\Capita Selecta\Assignments\Assignment 2.1\warmup-exercise\cgal_bootcamp.obj warmup-exercise
Error 2 error LNK2019: unresolved external symbol __imp____gmpq_clear referenced in function "public: __thiscall CGAL::Gmpq_rep::~Gmpq_rep(void)" ([email protected]@@[email protected]) C:\Dropbox\Capita Selecta\Assignments\Assignment 2.1\warmup-exercise\cgal_bootcamp.obj warmup-exercise
Error 3 error LNK1120: 2 unresolved externals C:\Dropbox\Capita Selecta\Assignments\Assignment 2.1\warmup-exercise\Debug\warmup-exercise.exe 1 1 warmup-exercise
4 IntelliSense: #error directive: "Mixing a dll CGAL library with a static runtime is a really bad idea..." c:\dev\cgal-4.3\include\cgal\auto_link\auto_link.h 364 4
5 IntelliSense: #error directive: "some required macros where not defined (internal logic error)." c:\dev\cgal-4.3\include\cgal\auto_link\auto_link.h 397 4
을 (나는 내가주의해야 아직도 C++에 대한 멍청한 의견). GMP 라이브러리에는 뭔가 이상한 점이 있습니다. 적어도 다른 게시물에서 libgmp 파일을 빌드하지 않았습니다 (더 이상 해당 게시물을 찾을 수 없음).하지만 그렇지 않습니다. 나를 위해 (나는 생각한다) : CGAL-4.3/auxiliary/gmp/lib에서 libgmp-10.dll libgmp-10.lib libmpfr-4.dll과 libmpfr-4.lib 네 개의 파일을 볼 수있다.
또한이 오류 ("정적 라이브러리와 함께 dll CGAL 라이브러리 믹싱은 정말 나쁜 생각입니다 ...")이 발생할 수있는 오류를 가리 킵니다. 그러나 실제로 어떤 의미인지는 알 수 없습니다. 또는 어떻게 해결할 수 있는지).
또한 다른 컴퓨터에서 모든 라이브러리를 설정하려고했지만 동일한 오류가 발생했습니다.
누구든지이 문제를 해결하기 위해 올바른 방향으로 나를 가리킬 수 있습니까? 더 자세한 정보가 필요하면 알려주십시오.
cgal_create_cmake_script를 사용하여 vcproj 파일을 만들었습니까? 나는 컴파일러가 GMP 라이브러리를 찾을 곳을 아는지 궁금해하기 때문에 물어 본다. –
libgmp-10.lib가 컴퓨터에 존재하지만 libmpfr-4.lib와 링크 할 수 있도록 프로젝트를 구성해야합니다. – lrineau
귀하의 반응에 감사드립니다! Andreas Fabri의 의견을 듣고 나서 Visual Studio 마법사에 의해 새로 생성 된 프로젝트에 소스 및 헤더 파일을 두는 것이 올바른 방법이 아니라는 것을 깨달았습니다. 이제 Visual Studio 프로젝트를 생성하기 위해 내 소스 파일에 cgal_create_cmake_script를 사용했으며이 프로젝트는 오류없이 빌드됩니다. 또한 응용 프로그램을 디버깅 할 수도 있습니다. 고마워요! – user2246266