Page 1 of 1
Using APIs with MFC
Posted: Sun Dec 28, 2014 10:25 pm
by yeonghun
Hi,
I'm trying to use OpenSim & Simbody APIs with MFC (developing in VS 2010)
But there are some errors when using OpenSim APIs.
When I include OpenSim.h in my project file, error C2589 is occured.
It does not occured when I use win32 console application project.
So I also trying to build SimBody and OpenSim from sources,
but problem was not solved.
Is there any thing I should do for using OpenSim APIs with MFC?
Or, is there anyone who using OpenSim APIs with QT platform?
Thanks.
Re: Using APIs with MFC
Posted: Sun Dec 28, 2014 10:39 pm
by sherm
Please provide detailed information about exactly what problem you are encountering. My guess is that a macro defined by one of the MFC headers is redefining a symbol that it is in use in OpenSim, but it is hard to tell without knowing precisely what the compiler is complaining about.
Sherm
Re: Using APIs with MFC
Posted: Sun Dec 28, 2014 10:48 pm
by yeonghun
Thanks for your reply.
The message that [error c2589 '(' : illegal token on right side of ':: '] is occured
when I trying to use OpenSim headers with MFC.
Detail messages are like this.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(323): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(323): error C2059: 구문 오류 : '::'
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(323): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(323): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(329): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(329): error C2059: 구문 오류 : '::'
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(329): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(329): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(335): error C2589: '(' : '::' 오른쪽에 잘못된 토큰이 있습니다.
1>c:\simbody\build\include\SimTKcommon/internal/NTraits.h(335): error C2059: 구문 오류 : '::'
Re: Using APIs with MFC
Posted: Sun Dec 28, 2014 11:13 pm
by sherm
Thanks -- it looks like those are complaints about calls to the C++ standard library function
std::max(). That is likely because Microsoft foolishly includes
max (and
min) macros in some Windows headers. Microsoft provides some advice here:
http://support.microsoft.com/kb/143208. Basically you can prevent the definition of those macros by preceding your first Windows include with
Regards,
Sherm
Re: Using APIs with MFC
Posted: Mon Dec 29, 2014 12:07 am
by yeonghun
Thanks, Sherman~!
I solve the problem by using your suggested method.
(Actually there are some problems remains using with MFC,
but with win32 dialog, using #define NOMINMAX solve the problem.)
best regards,
Yeonghun Kim