[HELP] fatal error LNK1120: 5 unresolved externals

Dear Sir/ Madam, A very good day to you. I installed boost 1.50 installer (32-bit) which downloaded from http://www.boostpro.com/download/ and did the appropriate settings (including CGAL) in Microsoft Visual Studio 2010. I would like to run the following sample code: #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; } There are no errors during compilation but there are errors during the build as shown below: 1>------ Build started: Project: Cgal_Hello, Configuration: Debug Win32 ------ 1>libboost_system-vc100-mt-gd-1_50.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_50.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 Can anyone please help me with this issues? desperately need help... In addition, if I have installed the installer, do I still have to use bjam.exe to build the libraries? Hope to hear from you soon. Thank you very much. -- Best Regards, Saw

[Seow Hui, Saw]
I installed boost 1.50 installer (32-bit) which downloaded from http://www.boostpro.com/download/ and did the appropriate settings (including CGAL) in Microsoft Visual Studio 2010.
1>libboost_system-vc100-mt-gd-1_50.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)
Somehow, you're mixing VC9 (VS 2008) and VC10 (VS 2010). You're linking to libboost_system-vc100-mt-gd-1_50.lib which has been built for VC10 (as indicated by "vc100"), and to the import lib (msvcprtd.lib) for MSVCP90D.dll which is VC9's (as indicated by "90"). VC's C++ Standard Library implementation forbids mixing different major versions like this, as we routinely break binary compatibility. This specific error is related to one of the changes between VC9 and VC10, when std::basic_string went from being DLL-exported to being header-only. Stephan T. Lavavej Visual C++ Libraries Developer
participants (2)
-
Seow Hui, Saw
-
Stephan T. Lavavej