Issues with XCode & CGAL

Discussion in 'Mac Programming' started by e-r-a-n, Nov 3, 2012.

  1. macrumors member

    Jan 5, 2012
    as part of my current project, I need to use the cgal library.
    therefore, i installed macports and used a command line to install the cgal files.
    i have under /opt/local/include/cgal/ a bunch of headers and some lib files under /opt/local/lib/

    i took a demo main.cpp, with just includes of some headers and a short main with "hello" print line.
    i added the include/cgal and local/lib/ as build path headers in my project settings under xcode:

    afterwards i compiled the code from an example, but removed the main to a simple print, just to see if i can compile it successfuly, so i used this code:

    it seems the build settings did help, but i still got this:

    Im not sure what i did wrong and how to treat this issue.
  2. macrumors member

    Jul 4, 2010
    I tried to recreate your problem and found that making the header search path non-recursive resolves those errors. To do that, just double click the search path in Xcode and choose non-recursive.
  3. thread starter macrumors member

    Jan 5, 2012
    Thank you for the effort
    however, i tried again and changed, it surely helped but i still havent got too much further.
    this is the new deal:

    i highly appreciate your help

    one more question, assuming my problems are over and it all compiles fine,
    is it possible to use the executable under windows somehow?
    so that i'll develop under osx but be able to use it also on windows?
    Im asking because its a part of a project which is intended to run under windows.
    but because installing cgal under windows was a major problem for me, i tried it on my home mac computer

    Attached Files:

  4. macrumors member

    Jul 4, 2010
    Min_sphere_of_spheres_d_traits_3.h appears to rely on some types declared in other headers, that's why you are getting the errors. If you include Min_sphere_of_spheres_d.h before Min_sphere_of_spheres_d_traits_3.h it should work.
    As long as you use only libraries and functions that are available for windows as well, there should be no problems. You will however have to recompile it for windows.
  5. e-r-a-n, Nov 5, 2012
    Last edited: Nov 5, 2012

    thread starter macrumors member

    Jan 5, 2012
    first of all, thank you. it does work now... i didnt know there're dependencies for min sphere of spheres 3d.

    second, When you say "recompile it again for windows", do you mean i need to compile it in a windows environment, or can i do it under xcode but with different settings?
    can you explain a bit more?
    i only wish to use the cgal library together with some basic iostream functionality
    programming under osx is very new to me, as i have my apple machine for about two-three weeks
  6. macrumors member

    Jul 4, 2010
    The easiest way is probably recompiling it in a windows environment using Visual Studio (at least that's what the CGAL manual says). You can try searching google for cross compilation to create a windows executable on your mac, but since I've never done that, I have no idea how difficult that will be.

Share This Page