Using APIs with MFC

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
YeongHun Kim
Posts: 6
Joined: Sun Apr 04, 2010 11:47 pm

Using APIs with MFC

Post by YeongHun Kim » Sun Dec 28, 2014 10:25 pm

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.

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Using APIs with MFC

Post by Michael Sherman » Sun Dec 28, 2014 10:39 pm

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

User avatar
YeongHun Kim
Posts: 6
Joined: Sun Apr 04, 2010 11:47 pm

Re: Using APIs with MFC

Post by YeongHun Kim » Sun Dec 28, 2014 10:48 pm

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: 구문 오류 : '::'

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Using APIs with MFC

Post by Michael Sherman » Sun Dec 28, 2014 11:13 pm

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

Code: Select all

#define NOMINMAX
Regards,
Sherm

User avatar
YeongHun Kim
Posts: 6
Joined: Sun Apr 04, 2010 11:47 pm

Re: Using APIs with MFC

Post by YeongHun Kim » Mon Dec 29, 2014 12:07 am

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

POST REPLY