C2440 error from CorePolicyAdapter.hpp

3 posts / 0 new
Last post
Offline
Last seen: 1 month 3 weeks ago
Joined: 03/15/2020
Posts: 2
C2440 error from CorePolicyAdapter.hpp

I created a VS2017 solution with 2 projects: Client and Manager following Request-Reply pattern and the 2 projects work well just until another project is added, called Services. All 3 of them are executable (.exe)

The Services is created for another Request-Reply communication with the Manager. Just when Services.hpp is written with:

#include "ndds_cpp.h"

The following build error appeared:

C2440    'initializing': cannot convert from 'initializer list' to 'DDS_LoggingQosPolicy'    Services    CorePolicyAdapter.hpp    165 

 
All necessary libraries are included exactly as Client and Manager projects, so I don't think that's because of the project configuration. Please help if anyone come up with any ideas, thank you.
Offline
Last seen: 2 days 21 hours ago
Joined: 04/02/2013
Posts: 124

It looks like you're including both the traditional C++ API (ndds_cpp.h) and the modern C++ API (CorePolicyAdapter.hpp). These two cannot be included in the same translation unit. 

More info:

https://community.rti.com/kb/how-do-i-use-traditional-c-and-modern-c-apis-same-application

https://community.rti.com/kb/differences-between-modern-and-traditional-c-apis

Offline
Last seen: 1 month 3 weeks ago
Joined: 03/15/2020
Posts: 2

Thank you alexc, you are right. After changing to <dds/dds.hpp> as the link suggested, things are good to go now. You saved my day, man :)