Tuesday 15 July 2014

c++11 - C++ Vector Sort method fails to compile, returns expected expression -


I am starting to work with cgal and I have just downloaded some sample code to get started. The problem is that when I try to compile the code, it gives returns:

  ConvexHull.cpp: 275: 40: error: expected expression sort (points.begin () , Points.end (), [P] (point 2a, point 2b) -> gtc: int {^ 1 error occurred. Make [2]: *** [CMakeFiles / exec.e.dir / ConvexHull. Cpp.o] make 1 error [1]: *** [CMakeFiles / exec.e.dir / all] Make Error 2: *** [All] Error 2   

When I Take a look at the code, everything looks fine:

  point_2 p = * (polygon.bottom_wetec S ();; sort (number.bjin (), point.and (), [p] (point 2a, point 2b) -> int {vector_2 v1 (a, p); vector 2 v2 (b) , P); Return v1 Direction () & lt; = v2.direction ();});   

Is this really false? Is I using the wrong compiler (it By default, using Clang 3.1.0 )? Do I miss anything?

Any help is greatly appreciated

By the way: I'm using OSX Lion to develop, and the only thing I found The method is using cgal (Hombrejh) and its dependencies. I run to compile:

  cd path / to / folder cgal_create_CMakeLists -c Qt4: core: GMP: MPFR: Boost -S Excel CMKD-DCGLIR = $ HOME / CGAL-4.2 -DCMAKE_BUILD_TYPE = debug   

edit

I use GCC-4.8 and G ++ - Managed to install 4.8. I run a cm command like this:

  semic - DCGLID = $ HOME / CGAL-4.2 -DCMAKE_CXX_COMPILER = G ++ - 4.8 -DCMAKE_CC_COMPILER = gcc-4.8   

also did not need to specify the c ++ 11 flag, it generates an executable file, but when I make it to ./ exec.e I use segfaults Segmentation error: 11 . I am very disappointed how difficult it is to be.

Edit

I used MacOS, I have compiled easily and on every required library and CGAL on Linux GCC-4.7 .

The code shown by you in C ++ is the most common compiler in C ++ 11 mode Have not run away from. Put them in your CMakeLists.txt

  set (CMAKE_CXX_FLAGS "$ {CMAKE_CXX_FLAGS} -std = c ++11") and let them do so explicitly.            

And your program To revive everything to work correctly,

No comments:

Post a Comment