Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] clang++ c++11 and stdlib libc++ on mac

Subject: CGAL users discussion list

List archive

[cgal-discuss] clang++ c++11 and stdlib libc++ on mac


Chronological Thread 
  • From: "Becksfort, Jared" <>
  • To: "" <>
  • Subject: [cgal-discuss] clang++ c++11 and stdlib libc++ on mac
  • Date: Wed, 23 Apr 2014 14:08:04 -0500
  • Accept-language: en-US
  • Acceptlanguage: en-US

Hello,

I have had some trouble getting programs using CGAL to run using c++11 on
a mac 10.8.5.

The issue is very likely to be related to the stdlib argument, I think. I
built boost using b2 and cgal using cmake with "-std=c++11
-stdlib=libc++", not brew or macports. I did use brew to install each
package a while back before using c++11, though, so there is some
possibility of files hanging around built against cstdlib (or whatever).


Does anyone know a good way to unravel or sort out this problem? Or
maybe, hopefully, I am just doing something dumb that will be easy for
someone to spot?

My clang++ version is

-----------
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
-----------


The unsuccessful CGAL program build command is:
--------------
clang++ -std=c++11 -stdlib=libc++ -L/usr/local/lib -lCGAL -lboost_thread
-o sout scratch_cgal.cpp

Undefined symbols for architecture x86_64:
"std::__1::basic_istream<char, std::__1::char_traits<char>
>::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
>(*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))",
>referenced from:
CGAL::operator>>(std::__1::basic_istream<char,
std::__1::char_traits<char> >&, CGAL::File_header_extended_OFF&) in
libCGAL.a(all_files.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
--------------

I am able to get programs that just use the compiled version of boost to
build and run in a similar manner, such as:
--------------
clang++ -o popts -std=c++11 -stdlib=libc++ -lboost_program_options
program_options.cpp
--------------

The test cgal program I am trying to build is:
--------------
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <iostream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Plane_3 Plane;

int main() {
int *x = nullptr; // just to ensure I don't forget the c++11
argument when testing the building

Point p1 = CGAL::Point_3<Kernel>(0, 0, 0);
Point p2 = CGAL::Point_3<Kernel>(7.6, -1.8, 500);
Point p3 = CGAL::Point_3<Kernel>(1, 1.0, 0);
Point p4 = CGAL::Point_3<Kernel>(0, 0, 1);
Plane plane = CGAL::Plane_3<Kernel>(p1, p2, p3);
double distance = CGAL::squared_distance(p4, plane);
std::cout << "distance2 is " << distance << std::endl;

std::cout << "finishing" << std::endl;
return 0;
}
--------------


Thanks!
Jared


Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer




Archive powered by MHonArc 2.6.18.

Top of Page