Skip to Content.
Sympa Menu

cgal-discuss - Fwd: [cgal-discuss] [HELP] error LNK2005 and error LNK2019

Subject: CGAL users discussion list

List archive

Fwd: [cgal-discuss] [HELP] error LNK2005 and error LNK2019


Chronological Thread 
  • From: "J.S. van Bethlehem" <>
  • To: "" <>
  • Subject: Fwd: [cgal-discuss] [HELP] error LNK2005 and error LNK2019
  • Date: Tue, 11 Sep 2012 10:30:56 +0200

I think something went wrong when I tried to send this message; it seems it didn't get send to the mail list. So here's another try.

Jakob

Begin forwarded message:

Hello Saw,

First of all thanks for creating a nice short message. Much more readable this way. 

Then regarding your issue: this is really a compilation problem, completely independent of both CGAL and probably also boost. My best guess from the (still rather limited info) is that your 'appropriate settings' are incorrect.

Generally, if you want to be sure you're not hitting some sort of bug, an excellent way to get more information is to google the error you get:
this simple step for example got me here for your first error:
For the second error it seems this is related:

If none of these are helpful to you, I'd suggest to google some further, and maybe also ask on the boost-mailing lists. And double check and triple check your 'appropriate settings'….. I'm almost 98% certain they are not 'appropriate'.

Greetsz, Jakob



Hi Jakob,

Thanks for your advices again. 
This time I installed a new version of boost 1.51 (64 bit) and do the appropriate settings in Microsoft Visual 2010.

As a result, I have the following errors during the build process:

1>libboost_system-vc100-mt-gd-1_51.lib(error_code.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libboost_system-vc100-mt-gd-1_51.lib(error_code.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xout_of_range(char const *)" (__imp_?_Xout_of_range@std@@YAXPBD@Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xran(void)const " (?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ)

1>D:\Cgal_Hello\Debug\Cgal_Hello.exe : fatal error LNK1120: 5 unresolved externals


Do you know what is this meant?
I know you have mentioned about MVS, but I don't quite understand about it. 
Could you please explain in detailed? Or do you have any link that I can go for references? 

Hope to hear from you again.
Thank you very much.

Best Regards,
Saw

On Fri, Aug 31, 2012 at 4:16 PM, Jakob van Bethlehem <> wrote:
Hello Saw,

Your compiler already tells you what to do:
<QUOTE>The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss<ENDQUOTE>

It seems you somehow ended up with some weird characters somewhere. Have a look at that first.
BTW, in the future, I'd advise you to copy the warning only -once-, when all warnings are the same anyway.

With regards to your link error,  the error you get is quite straightforward: a lot of stuff in 'libboost_thread-vc100-mt-gd-1_49.lib' is doubly defined in 'msvcprtd.lib', and some __decl* links can not be found. My first guess is you need to tweak the libraries you pass on to the compiler, using -L and -l (I'm sure there is some menu for it in MVS) If I remember correctly, there has been some discussion on this mailing list very recently regarding MVS. Maybe you can find that, and see if that was about the same problems you're having.

Greetsz, Jakob
Dear Sir/ Madam,

Good day to you.
I have installed CGAL 3.9 and boost 1.49 for my project and I believe I have
made the correct settings for my project using Microsoft Visual Studio 2010.

I tried to build a simple CGAL program as shown below:

#include<iostream>
#include<CGAL\Exact_predicates_inexact_constructions_kernel.h>
#include<CGAL\convex_hull_2.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;

int main()
{
        Point_2 points[5] = { Point_2(0, 0), Point_2(10, 0), Point_2(10, 10),
Point_2(6, 5), Point_2(4, 1) };
        Point_2 result[5];

        Point_2 *ptr = CGAL::convex_hull_2( points, points+5, result );
        std::cout<<  ptr - result<<  " points on the convex hull"<<
std::endl;

        return 0;
}

--------------------------------------------------------------------------------------------------

When I compiled this, I got a lot of warnings but no errors as shown below:


1>------ Build started: Project: Cgal_Hello, Configuration: Debug Win32 ------
1>   hello_world.cpp
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\boost_1_49_0\boost\type_traits\detail\has_binary_operator.hpp : warning
C4819: The file contains a character that cannot be represented in the current
code page (932). Save the file in Unicode format to prevent data loss
1>c:\program files (x86)\cgal-3.9\include\cgal
\extended_euclidean_algorithm.h : warning C4819: The file contains a character
that cannot be represented in the current code page (932). Save the file in
Unicode format to prevent data loss
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


When I build the project, I got the following errors:


1>------ Build started: Project: Cgal_Hello, Configuration: Debug Win32 ------
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2005: "public:
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char>  >::basic_string<char,struct std::char_traits<char>,class
std::allocator<char>  >(char const *)" (??0?$basic_string@DU?
$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in
msvcprtd.lib(MSVCP90D.dll)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2005: "public:
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char>  >::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char>  >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2005: "public:
char const * __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>  >::c_str(void)const " (?
c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ)
already defined in msvcprtd.lib(MSVCP90D.dll)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2005: "public:
static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?
length@?$char_traits@D@std@@SAIPBD@Z) already defined in
msvcprtd.lib(MSVCP90D.dll)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static void __cdecl
std::char_traits<char>::assign(char&,char const&)" (?assign@?

$char_traits@D@std@@SAXAADABD@Z) already defined in libboost_thread-vc100-mt-
gd-1_49.lib(thread.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: unsigned int __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char>  >::size(void)const " (?size@?$basic_string@DU?
$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ) already defined in
libboost_thread-vc100-mt-gd-1_49.lib(thread.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall
std::_String_val<char,class std::allocator<char>  >::~_String_val<char,class
std::allocator<char>  >(void)" (??1?$_String_val@DV?
$allocator@D@std@@@std@@QAE@XZ) already defined in libboost_thread-vc100-mt-
gd-1_49.lib(thread.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall
std::allocator<char>::allocator<char>(void)" (??0?$allocator@D@std@@QAE@XZ)
already defined in libboost_thread-vc100-mt-gd-1_49.lib(thread.obj)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base12::~_Container_base12(void)" (__imp_??
1_Container_base12@std@@QAE@XZ) referenced in function __unwindfunclet$??0?
$_String_val@DV?$allocator@D@std@@@std@@QAE@V?$allocator@D@1@@Z$0
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base12::_Container_base12(void)" (__imp_??
0_Container_base12@std@@QAE@XZ) referenced in function "public: __thiscall
std::_String_val<char,class std::allocator<char>  >::_String_val<char,class
std::allocator<char>  >(class std::allocator<char>)" (??0?$_String_val@DV?
$allocator@D@std@@@std@@QAE@V?$allocator@D@1@@Z)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base12::_Orphan_all(void)" (__imp_?
_Orphan_all@_Container_base12@std@@QAEXXZ) referenced in function "public:
__thiscall std::_String_val<char,class std::allocator<char>
::~_String_val<char,class std::allocator<char>  >(void)" (??1?$_String_val@DV?
$allocator@D@std@@@std@@QAE@XZ)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char
const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z) referenced in function
"public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>  >::_Xlen(void)const " (?
_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ)
1>libboost_thread-vc100-mt-gd-1_49.lib(thread.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) void __cdecl std::_Xout_of_range(char
const *)" (__imp_?_Xout_of_range@std@@YAXPBD@Z) referenced in function
"public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>  >::_Xran(void)const " (?
_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ)
1>D:\Cgal_Hello\Debug\Cgal_Hello.exe : fatal error LNK1120: 5 unresolved
externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Anyone know the reasons behind these errors? How can I solve these problem?
Thank you very much.

Regards,
Saw



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss





--

Best Regards,

Saw Seow Hui
Lecturer
Faculty of Information and Communication Technology
Department of Computer Science
University Tunku Abdul Rahman (UTAR)
Jalan Universiti, Bandar Barat,
31900 Kampar, Perak.







Archive powered by MHonArc 2.6.18.

Top of Page