#ifdef STUFF

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?

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.

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.

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   

And it worked :-)

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

Yes, either way works.