Sign in to follow this  
lucky6969b

Namespace problem with boost and maxsdk

Recommended Posts

lucky6969b    1330
 
#include "kwxport.h"

#include "resource.h"

#ifndef __TCONVERT_H__
#define __TCONVERT_H__
#endif
#ifndef _INC_TCHAR
# include <tchar.h>
#endif
#ifndef _INC_CRTDBG
# include <crtdbg.h>
#endif
#ifndef _WINDOWS_
# include <windows.h>
#endif

#include <d3dx9xof.h>
#include "rmxftmpl.h"
#include "rmxfguid.h"
#include <d3dx9mesh.h>

#include <dbghelp.h>
#include <plugapi.h>
#include <hold.h>
#include <quat.h>
#include <IDxMaterial.h>
#include <IPathConfigMgr.h>
#include <crtdbg.h>
#include <maxapi.h>
#include <interval.h>

#include <set>
#include <algorithm>
#include <sstream>

//#include "kwlog.h"
#include "exportmain.h"


#define USE_FILE_RESOLUTION 0
#define IGAME_BUG 0
#if defined(MAX_RELEASE)
#if defined(MAX_RELEASE_R12_ALPHA) && MAX_RELEASE >= MAX_RELEASE_R12_ALPHA
#undef USE_FILE_RESOLUTION
#define USE_FILE_RESOLUTION 1
#include <AssetManagement/AssetUser.h>
#include <IFileResolutionManager.h>
#pragma comment(lib, "assetmanagement.lib")
#if defined(_M_X64)
#undef IGAME_BUG
#if !defined(MAX_RELEASE_R13) || MAX_RELEASE < MAX_RELEASE_R13
#define IGAME_BUG 1
#else
#define IGAME_BUG 0
#endif
#endif
#endif
#else
#error "MAX_RELEASE must be defined!"
#endif

//TODO: for 1.5, support sorting transparent material triangles and splitting 2-sided triangles
//TODO: for 1.5, convert textures to DDS when "rename to dds" and "copy textures" are on
//TODO: for 1.5, convert the settings interface to use real ParamBlk2, and expose a Utility
// that allows editing it.

//BUG: There appears to be a pivot center offset problem
//FIXED: There appears to be some problem with non-contiguous texture map channels

#if 0 // todo: remember to set to 0 before ship!
#define OPTIMIZED 0
#else
#define OPTIMIZED 1
#endif

#if !OPTIMIZED
#pragma optimize("", off)
#endif

#include <boost/property_tree/ptree.hpp> <<<<<<<<<<< Error 2544
#include <boost/property_tree/xml_parser.hpp>

// Create an empty property tree object
using boost::property_tree::ptree;
ptree exportedData;


#pragma comment(lib, "bmm.lib")
//#pragma warning(disable: 4312) // cast int/pointer

#define MAX_UV_SETS 4

 
Warning    1    warning C4003: not enough actual parameters for macro 'base_type'    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
Error    2    error C2544: expected ')' for operator '()'    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
Error    3    error C2059: syntax error : '('    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
Error    4    error C2091: function returns function    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
Error    5    error C2143: syntax error : missing ',' before '&'    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
Error    6    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
Error    7    error C2059: syntax error : '('    E:\Programming\Libraries\boost_1_54_0\boost\serialization\collection_size_type.hpp    41    1    kwxport
[/code]

The maxsdk and boost both have the base_type methods.

Tried to include the boost::serialization namespace to to avail

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites
NightCreature83    5002

You can also wrap one of the includes into another namespace everywhere you use it that should fix your issue as well. You should be very careful with using namespace <bla> as these will import all the names in that space into the current namespace and potentially pollute it.

namespace MAX_SDK
{
#include <maxsdk.h>
}

Edited by NightCreature83

Share this post


Link to post
Share on other sites
Bregma    9201
not enough actual parameters for macro 'base_type'

 

This implies maxsdk has a preprocessor macro 'base_type'.  Try using a replacement library that works with code written in the 1990s or later.

 

C preprocessor macros do not have namespaces and any header that uses them like that is bad software.  You might be able to work around the problem by adding an "#undef base_type" after the #include for your maxsdk headers.

Share this post


Link to post
Share on other sites
LorenzoGatti    4442

#undef base_type" after the #include for your maxsdk headers.

killing off troublesome macros with #undef is the only safe and general solution.
In this case moving the Boost include directives far earlier in the file (line 1 is a good choice), before naughty headers soil the preprocessor, should also work because they are libraries and nothing in the other includes depends on them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this