API Compile Errors on Mac



  • On 13/07/2013 at 16:42, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:    Mac  ;  
    Language(s) :     C++  ;

    ---------
    I finally got a Mac and I'm trying to compile the Cinema 4D API. I get the following errors in
    c4d_basedocument.cpp:

    ../../resource/_api/c4d_basedocument.cpp:263:52: error: conversion from 'int' to
          'const GeData' is ambiguous
            this->SetParameter(DescLevel(DOCUMENT_USERCHANGE),TRUE...
                                                              ^~~~
    ../../resource/_api/ge_sys_math.h:21:15: note: expanded from macro 'TRUE'
            #define TRUE    1
                            ^
    ../../resource/_api/c4d_gedata.h:97:3: note: candidate constructor
                    GeData(double n)
                    ^
    ../../resource/_api/c4d_gedata.h:110:3: note: candidate constructor
                    GeData(LONG n)
                    ^
    ../../resource/_api/c4d_gedata.h:116:3: note: candidate constructor
                    GeData(SReal n)
                    ^
    ../../resource/_api/c4d_basedocument.cpp:386:51: error: conversion from 'Bool'
          (aka 'int') to 'const GeData' is ambiguous
            this->SetParameter(DescLevel(DOCUMENT_RENDERLOD),lod...
                                                             ^~~
    ../../resource/_api/c4d_gedata.h:97:3: note: candidate constructor
                    GeData(double n)
                    ^
    ../../resource/_api/c4d_gedata.h:110:3: note: candidate constructor
                    GeData(LONG n)
                    ^
    ../../resource/_api/c4d_gedata.h:116:3: note: candidate constructor
                    GeData(SReal n)
    

    I'm compiling by the command line, but I've been looking at the cinema4dsdk.xcodeproj and couldn't
    find any compiler option which could fit.

    I'm using clang.

    Thanks in advance!!
    -Niklas



  • On 13/07/2013 at 19:12, xxxxxxxx wrote:

    I'd stick with Xcode.  Maxon does not provide support for other build systems.



  • On 13/07/2013 at 23:50, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    [..]
    ]I'm compiling by the command line, but I've been looking at the cinema4dsdk.xcodeproj and couldn't
    find any compiler option which could fit.
    I'm using clang.
    Thanks in advance!!
    -Niklas

    We're using clang too. Have a look into Xcode's build messages - you can open them for each source file to see the command line parameters and also take a look into _apibase_debug.xcconfig, _api_debug.xcconfig, _apibase_release.xcconfig and _api_release.xcconfig .

    Best regards,

    Wilfried



  • On 14/07/2013 at 01:28, xxxxxxxx wrote:

    Thank you Wilfried, I'll look through it! Hm, is there more than one version of Clang? The compiler options
    I found in the _api up until now mostly didn't work with Clang at all. For example, in the "Other C++ Flags" section, the following flags are given:

    -funsafe-math-optimizations
    -ffinite-math-only
    -fno-signaling-nans
    -fno-rounding-math
    -fcx-limited-range
    -ftrapping-math

    And the option "ICC_OTHER_CPLUSPLUSFLAGS" option contains the following flags (for Release)

    -wd68,191,279,654,858,1899,10120
    -fp-speculationsafe 
    -unroll
    -O3

    But only a few of them work with the Clang on my Mac.

    clang++ -c -std=c++11 -funsafe-math-optimizations -ffinite-math-only -fno-signaling-nans -fno-rounding-math -fcx-limited-range -ftrapping-math -wd68,191,279,654,858,1899,10120 -fp-speculationsafe -unroll -O3 -O3 -DMAC -D__MAC -I../../resource/_api -I../../resource/_api/c4d_misc -I../../resource/_api/c4d_misc/memory -I../../resource/_api/c4d_misc/datastructures -I../../resource/_api/c4d_preview -I../../resource/_api/c4d_customgui -I../../resource/_api/c4d_libs -I../../resource/_api/c4d_gv -I../../resource/res/description -I../../resource/modules/Modeling/res/description -I../../resource/modules/modeling/res/description -I../../resource/modules/newman/res/description -I../../resource/modules/xtensions/res/description -o obj/x86/c4d_basedocument.o ../../resource/_api/c4d_basedocument.cpp -I./ -Ires/description/ -Iinclude/
    clang: warning: argument unused during compilation: '-fno-signaling-nans'
    clang: warning: argument unused during compilation: '-fno-rounding-math'
    clang: warning: argument unused during compilation: '-fcx-limited-range'
    clang: warning: argument unused during compilation: '-wd68,191,279,654,858,1899,10120'
    clang: warning: argument unused during compilation: '-fp-speculationsafe'
    clang: warning: argument unused during compilation: '-u nroll'
    

    Unfortunately I have some troubles compiling with XCode as well, so I wasn't able to compile the SDK
    and API with XCode so far. I get a bunch of "Permission Denied" errors when XCode wants to create
    the output directories.

    Thanks for the help!
    -Niklas



  • On 14/07/2013 at 01:49, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    [...]
    Unfortunately I have some troubles compiling with XCode as well, so I wasn't able to compile the SDK
    and API with XCode so far. I get a bunch of "Permission Denied" errors when XCode wants to create
    the output directories.
    Thanks for the help!
    -Niklas

    The Cinema sdk project uses the clang version that is built into the xcode version you're using. In your snipet you've added several options that are intended for the Intel (ICC) compiler for the Mac only. Don't use them with clang.

    Make sure you've read/write permisson for the sdk folder, the api folder and the build directory. If you look at the build message (you can unfold them too like the build messages for every source file) it will tell you where it didn't have the permission.

    The sdk is part of every build process of Cinema. Given that you have a proper Xcode installation and r/w permissions, you can be sure that it will build (otherwise there would be no Cinema build at all).

    Best regards,

    Wilfried

    P.S.: Make sure the Xcode command line tools (Preferences->Downloads) are installed; they are included in Xcode 5, but for older versions you've to make sure they've been downloaded and installed.



  • On 14/07/2013 at 01:50, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Unfortunately I have some troubles compiling with XCode as well, so I wasn't able to compile the SDK and API with XCode so far. I get a bunch of "Permission Denied" errors when XCode wants to create the output directories.
    Thanks for the help!-Niklas

    Where are you compiling the SDK? If you are using the folder applications\maxon\cinema 4d\plugin\cinema4dsdk you may get problems because OSX protects the applications folder. That might be the reason for the permission errors.



  • On 14/07/2013 at 05:48, xxxxxxxx wrote:

    Thanks to both of you. As, I was trying to compile Cinema 4D from the applications folder. I moved it
    to another folder and the compilation worked! :)

    After trying each and every command-line option that I saw was used in the build-log of XCode, I found
    the one I was missing is

    -include ../../resource/_api/ge_mac_flags.h
    

    Works fine now. Thanks again!  👍


Log in to reply