[Reposted] How to add an idl file to the project

10 posts / 0 new
Last post
Offline
Last seen: 6 years 3 months ago
Joined: 03/27/2013
Posts: 28
[Reposted] How to add an idl file to the project

Hello everybody

I use an evaluation license and I want to use an idl file in my MFC project, but once I add the idl file to source filter of my project  I get MIDL error and the project does not build.

Could you tell what exact steps I should take to build such a project? I add the idl file to "source files" filter; then add another filter to the project and add the autogenerated files to that.

The RTI sample project " Hello_idl " , runs successfully on my machine.So I made a copy of this project, removed these files (Type Plugin files + .idl file ) from the project an added them to the project again and I got this MIDL error!  So It is obvious that there is something that I have to be aware of when using idl files.

Could you help me ? Im really confused!!!

 

rip
rip's picture
Offline
Last seen: 20 hours 22 min ago
Joined: 04/06/2012
Posts: 324

Hi,

midl.exe is the Microsoft IDL compiler.  The types you've defined for DDS require the rtiddsgen IDL compiler.  You'll need to change the configurations/settings for your IDE, so that it knows to call rtiddsgen (and its options), rather than midl.exe and its options.  Good luck. 

This response based on pure conjecture.

Or, remove the IDL from the source files filter.  When you want to regenerate from the IDL, call the rtiddsgen compiler manually, and only add the generated files to the source files filter.

rip

Offline
Last seen: 6 years 3 months ago
Joined: 03/27/2013
Posts: 28

Hi,

Thanks a lot rip, that was a great hint.

but where can I find the rtiddsgen compiler? Is it installed on my machine individually?

Thanks again for your kind assistance.

rip
rip's picture
Offline
Last seen: 20 hours 22 min ago
Joined: 04/06/2012
Posts: 324

Yes, the rtiddsgen idl compiler is supplied with your eval installation.

If your path is set correctly "rtiddsgen" from the command line should work.  If not, add %NDDSHOME%\scripts to your path.

For the command line options and how to use the compiler, see the User's Manual, also supplied with the installer, in %NDDSHOME%\docs\pdf

rip

Offline
Last seen: 6 years 3 months ago
Joined: 03/27/2013
Posts: 28

Hi again,

Thanks to you, I've tried the second solution u mentioned ( removing the idl file and calling the rtiddsgen compiler manually) . It helped me build a win32 application but not the MFC project. I get this error when it's compiling HelloWorldSupport.cxx , HelloWorldPlugin.cxx ,HelloWorld.cxx  files :

error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

I have included "stdafx.h" in my project , do you have any idea why this happens?

 

rip
rip's picture
Offline
Last seen: 20 hours 22 min ago
Joined: 04/06/2012
Posts: 324

Nope, Sorry.  That's Windows tools related. 

Might be related to the version of VS you are using vs. the architecture you selected,

Might be any number of things. 

What does Google return when you search for this online?  This is outside our ability to help from even a quasi-official standpoint -- you need a MS VS .sln expert, not an RTI Connext DDS expert.

rip

Offline
Last seen: 6 years 3 months ago
Joined: 03/27/2013
Posts: 28

I'm just new in this field so I asked to make sure this problem is not related to RTI configurations. Now I know that I can fix it myself. 

Thank you so much for your help and time rip.

At last, is there any document other than the user manual that you suggest, to help me start building my own projects? the resources I've seen on RTI website are very useful for learning the concepts but I didn't find something that explains the procedure (the project properties that must be set, etc. ) in details. I actually learned some by try and error and I'm not sure if they work in all conditions.

much obliged,

rip
rip's picture
Offline
Last seen: 20 hours 22 min ago
Joined: 04/06/2012
Posts: 324

there's a getting started guide.  Launch the RTI Launcher, go to the fourth tab (Configuration) and the first link under documentation is Getting Started guide.

The general steps are:

1) Define your data model <-- do you note how I toss aside a small epic in just four words? *flex* *flex*

2) Implement model using IDL (Defining Types using IDL)

3) Generate source from IDL using rtiddsgen (Using rtiddsgen)

-- if you use -example <arch> you get an example publisher and subscriber for the last defined struct FooType {...} in the IDL file

4) Compile the publisher and subscriber and run them, you should get flow (of empty types, since you didn't edit the publisher to put something into the instance being published)

5) Edit the publisher (where it says "Edit the instance to be published here" or similar).  Also make sure you change the Topic name to something other than "Example FooType".

6) Crack your knuckles, drink some coffee, and have fun as you dive in to the wonnerful world of data centric design

7) Pepper your social media commentary with things like "Connect DDS from RTI just ROCKS!"

because it does.

 

regards,

rip

rose's picture
Offline
Last seen: 2 years 8 months ago
Joined: 08/22/2011
Posts: 148

Hello Randy, 

When you are getting past the hello world stage, I recommend taking a look at some of our new best practices documents:

http://community.rti.com/best-practices

In particular, the two that people have the most trouble with when getting started: 

Thank you!

Rose

Offline
Last seen: 6 years 3 months ago
Joined: 03/27/2013
Posts: 28

Hi Rose,

Thank you so much for your time. These best practices docs are very helpful .