Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    #ifdef STUFF

    SDK Help
    0
    5
    494
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 27/06/2014 at 10:54, xxxxxxxx wrote:

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

      ---------
      Where do I get a list of all the possible definition I may check for?
      For example, I know that I can check for __MAC, __PC, C4D_R11, C4D_R12, etc
      But where do I find all those definitions?
      I need to do conditional code compilation depending on whether I'm compiling for Win32 or for x64. What #ifdef should I use?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 27/06/2014 at 15:43, xxxxxxxx wrote:

        Maxon defines most of these in the API project and they are inherited by the cinema4dsdk project (the one you use as a template for your own plugins).  You can create any preprocessor definition with

        #define STUFF
        

        or enter it into the Preprocessor Definitions of the C++ Compiler section of the project settings.

        I typically put an _C4D64 into the Preprocessor Definitions of the 64-bit build to distinguish and use that in the code (#ifdef _C4D64 ... #endif) when needed.

        Also, if you can help it, you should never #include headers in other headers.  Do that in the cpp file.  And instead of using the old #ifdef _MY_FILE_H_ blah, put '#pragma once' at the top of the header to only have it included one time.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 28/06/2014 at 01:57, xxxxxxxx wrote:

          For 64-bit compilation, isn't there a WIN64 define already in the _api project, that will be inherited? IOW no need to create your own definition.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 28/06/2014 at 02:50, xxxxxxxx wrote:

            I found the WIN64 definition in some code posted here.
            So, I assumed that there would also be a WIN32 definition.
            I tried:

              
            #ifdef WIN32   
            ... my code that should only be built for Windows 32 bits   
            #endif   
            

            And it worked 🙂

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 28/06/2014 at 06:03, xxxxxxxx wrote:

              Yes, either way works.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post