Hi everyone!
I'm new with RTI and DDS and I'm trying to generate code from 2 IDL files and compile it.
I'm trying with the Foo/Bar example, so the foo.idl file is:
#ifndef FOO_IDL
#define FOO_IDL
struct Foo { long data; };
#endif
the bar.idl code is:
#ifndef BAR_IDL
#define BAR_IDL
#include "foo.idl"
struct Bar { Foo foo; };
#endif
I use the following commands to generate the code from RTI:
rtiddsgen -language C++11 -example x64Win64VS2015 <foo.idl path>\foo.idl
it works fine and the build in VS2015 works too.
Now I try the same with the bar.idl file but adding a specification to the foo.idl path:
rtiddsgen -language C++11 -example x64Win64VS2015 -I <foo.idl path> <bar.idl path>\bar.idl
this time the code generation works but when i try to build the solution in VS2015 I got some errors with Code C1083: "Cannot open include file foolmpl.h: No such file or directory"
Anyone knows why this happens?
What I need is to have different IDL files and to create a nested structure, I know it is possible to do it writing everything in the same IDL file but it is not my case.
Thanks
Hi Luigi,
It looks like Visual Studio is not able to find foolmpl.h. It seems that the location of foolmpl.h is not in the "include directories" section of the Visual Studio project. I think that you may find the information in this article very useful, since it seems that it is the same use-case you are trying to create: https://community.rti.com/kb/how-generate-code-base-and-derived-idl-separate-dll-files
Please, let me know if it helped.
-Fran
Hi Francisco,
I tried to follow your guide with the base-derived example but I have encountered a problem when I try to run the .exe files because the derived publisher/subscriber does not find the base publisher/subscriber.exe.
What I want to do is to create a .lib file with only the header files as it is suggested in this topic---> https://community.rti.com/comment/2356#comment-2356
Do you know where is it the error? Do you have other tips?
Thanks,
Luigi
Hi Luigi,
I just reproduced your issue. I guess that your bar application is linked dynamically. Then, when you launch bar_publisher.exe, it will try to take foo_publisher.exe as if it was a DLL file. If you add to your PATH variable the location of foo_publisher.exe, running bar_publisher.exe should work. If you follow bullet point 2 from "How to compile a derived project in C++/CLI" on the article that I provided, you will see how to change that .exe to .dll.
If you link your application statically, you will need to add the foo_publisher.lib file as explained in bullet point 4 of "How to compile a derived project in C/C++".
-Fran
Hi Fran,
I'm trying to follow your tips, this is what I have done (using the base/derived example):
NDDS_USER_DLL_EXPORT_BASE
in the preprocessor properties of every base project and built them.I think there is someting missing since I cannot follow the step 4 correctly. In fact when I try to run derived_publisher.exe I get an error message telling me that it does not find the base_publisher.dll file as I was expecting...
EDIT:
I found out that the problem was that I was running the derived project from a random folder, if I go in the base\obj\<architecture> folder (where the base .dll files are) and I run the derived pub\sub it works.
Do you know if there is a way to make it easier?
Thanks,
Luigi