Jump to content
OpenSplice DDS Forum
Sign in to follow this  
Pepijn

Generated IDL file fails to build on Windows

Recommended Posts

I have a CMake project that generates a shared library based on a IDL file. On linux this works great, and installs a .so file in /usr/local.

But now I'm trying to compile the same project on Windows. I have downloaded DDS Community Edition Version 6.x for Windows (64-bit) Host and Target, Visual Studio 2015, x64 chipset, and have installed Visual Studio 2015.

CMake successfully generates an Visual Studio Solution file, but when I open this file in Visual Studio 2015 and build it, I get the following errors:

Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK1120    3 unresolved externals    Operator    C:\Users\rove\Documents\GitHub\rove_msgs\build\Debug\Operator.dll    1    
Error    LNK2019    unresolved external symbol __imp__c_stringNew_s referenced in function "unsigned char __cdecl __Operator_Control__copyIn(struct c_base_s *,class Operator::Control const *,struct _Operator_Control *)" (?__Operator_Control__copyIn@@YAEPAUc_base_s@@PBVControl@Operator@@PAU_Operator_Control@@@Z)    Operator    C:\Users\rove\Documents\GitHub\rove_msgs\build\OperatorSplDcps.obj    1    
Error    LNK2019    unresolved external symbol "__declspec(dllimport) unsigned char __cdecl __DDS_Time_t__copyIn(struct c_base_s *,class dds::core::Time const *,struct _DDS_Time_t *)" (__imp_?__DDS_Time_t__copyIn@@YAEPAUc_base_s@@PBVTime@core@dds@@PAU_DDS_Time_t@@@Z) referenced in function "unsigned char __cdecl __Operator_Control__copyIn(struct c_base_s *,class Operator::Control const *,struct _Operator_Control *)" (?__Operator_Control__copyIn@@YAEPAUc_base_s@@PBVControl@Operator@@PAU_Operator_Control@@@Z)    Operator    C:\Users\rove\Documents\GitHub\rove_msgs\build\OperatorSplDcps.obj    1    
Error    LNK2019    unresolved external symbol "__declspec(dllimport) void __cdecl __DDS_Time_t__copyOut(void const *,void *)" (__imp_?__DDS_Time_t__copyOut@@YAXPBXPAX@Z) referenced in function "void __cdecl __Operator_Control__copyOut(void const *,void *)" (?__Operator_Control__copyOut@@YAXPBXPAX@Z)    Operator    C:\Users\rove\Documents\GitHub\rove_msgs\build\OperatorSplDcps.obj    1    

I have also tried to run it in a shell with the env activated, with the same result.

>C:\dds\HDE\x86_64.win64\release.bat
>devenv /build Release RoVe.sln

I even tried rebuilding using these instructions. So now I'm out of ideas.

Share this post


Link to post
Share on other sites

I solved it in the end. It turns out that a DLL needs all its dependencies linked, while a SO is happy to find them at runtime. So after adding the DDS libraries as a dependency to the DLL in cmake, it worked. Well, kinda, you also need to export all the symbols.

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  

×