Solved std compile error

hi,
i meet compile error when use std in r19, the specific error prompts and simple test codes are as follows

//main.cpp
#include "c4d.h"
#include "main.h"
#include <string>

Bool PluginStart()
{
   std::string test;
        ...
}

errors:

Error	C2784	'const _Ty &std::_Max_value(const _Ty &,const _Ty &) noexcept': could not deduce template argument for 'const 
                _Ty &' from 'unsigned __int64'    
                e:\visualstudio2017\vc\tools\msvc\14.16.27023\include\xmemory0	45	
Error	C2782	'const _Ty &std::_Max_value(const _Ty &,const _Ty &) noexcept': template parameter '_Ty' is ambiguous		 
                e:\visualstudio2017\vc\tools\msvc\14.16.27023\include\xmemory0	45	
Error	C2672	'_Max_value': no matching overloaded function found	 
                e:\visualstudio2017\vc\tools\msvc\14.16.27023\include\xmemory0	43	

it no errors in r20, and if any additional considerations in r19 when use std?

hope your help!

Ok, could reproduce it.

That's because of the platform toolset. (using a different Visual Studio)

In your project properties, Configuration Properties -> General -> Platform Toolset you should have Visual Studio 2015 (v140).

If you don't have it, you have to install it.

Cheers
Manuel

MAXON SDK Specialist

MAXON Registered Developer

hello,

I've marked your thread as a question, feel free to mark it as solved when you think it is, see this thread for information : Q&A New Functionality.

Regarding your issue, i couldn't reproduce it using both visual studio 2015 and 2017.

You should probably stick to this recommendation regarding the visual studio to use :
https://developers.maxon.net/?page_id=1108

About string you should use our builtin String class. We have a manual with lot of information

Are you trying this with the Cinema4D SDK example or your own project ?
Does this project is coming from r19 or an older version ?

Cheers
Manuel

MAXON SDK Specialist

MAXON Registered Developer

@m_magalhaes use r19 sdk , not change any thing, just add two line in main.cpp:

...//other head file
#include <string>
Bool PluginStart()
{
	VERSIONTYPE versionType = GeGetVersionType();

	std::string test;
        ...
}

it will case same error. not only std::string, other like std::vector, std::set also fail. looks like something conflict with std in r19.

Ok, could reproduce it.

That's because of the platform toolset. (using a different Visual Studio)

In your project properties, Configuration Properties -> General -> Platform Toolset you should have Visual Studio 2015 (v140).

If you don't have it, you have to install it.

Cheers
Manuel

MAXON SDK Specialist

MAXON Registered Developer

@m_magalhaes thank you! switch to 2015(v140) is all right : )

I know this is quite an old topic, @m_magalhaes @Jmelon it would compile if you put c4d.h at the end of all other STL includes