LNK2019 Error

6 posts / 0 new
Last post
Offline
Last seen: 2 years 8 months ago
Joined: 07/26/2021
Posts: 4
LNK2019 Error

I have multiple idl files, I but all of them in the sam directory.

I was able to generate the project files using rtiddsgen.

When I attempted to build the generated project, I kept getting LNK2019 errors.

Does anyone has any idea as to why I'm getting that or how can I overcome these errors?

Howard's picture
Offline
Last seen: 6 days 9 hours ago
Joined: 11/29/2012
Posts: 567

Undefined symbol error during linking means that your project is missing the compiled filed that define the symbol.

Not sure how you are using multiple IDL files.  Typically, you need to run rtiddsgen over all of the IDL files individually and then include the type definition/support/plugin source files in your project.

The example project that rtiddsgen can produce does NOT do that.  It only works with 1 IDL file at a time.  You will have to run rtiddsgen (without the -example) on all of the IDL files and then include the source code in the project that you want to build.

Offline
Last seen: 2 years 8 months ago
Joined: 07/26/2021
Posts: 4

Thanks for your reply, it cleared many things for me.

I was running rtiddsgen over 1 idl file, which was incorrect.

I ran rtiddsgen over all of the idl files without th example, but now I don't see the subscribr publisher part.

These are the steps I followed:

1. Put all of the idl files in one directory (there are four files).

2. Copy x64 file content into the idl files directory.

3. Run rtiddsgen over all the files one file at a time using this: <file location> -language C++ -namespace -create typefiles -create makefiles -platform x64Win64VS2017

 

Then what is the next step? Do I create a project, include all of the generated files into the project and then building?

Howard's picture
Offline
Last seen: 6 days 9 hours ago
Joined: 11/29/2012
Posts: 567

I'm not sure what you mean by  "2. Copy x64 file content into the idl files directory.".  What is x64 file content?

In any case, you only need to use "-create makefiles -platform x64Win64VS2017" on the single IDL file that contains the data type that you want to have example applications that publishes and subscribes.

For all of the other IDL files, do not use "-create makefiles -platform x64Win64VS2017".

Then open the VS .sln and add all of the .cxx files that were generated for the other IDL files to the publisher and subscriber projects as source files that need to be compiled and linked in for the executable.

Offline
Last seen: 2 years 8 months ago
Joined: 07/26/2021
Posts: 4

Thanks a lot Howard!

That worked.

 

 

x64 files are the CL.exe file as well as everything located in that directory. Because rtiddsgen was giving me a CL.exe error.

Howard's picture
Offline
Last seen: 6 days 9 hours ago
Joined: 11/29/2012
Posts: 567

The cl.exe is only used as a c-preprocessor...which you can disable by using -ppdisable on the command line.  I believe that the error message printed by rtiddsgen states that.

Usually, you don't need to copy the executables of Visual Studio anywhere.  If you need them on the command line, the general practice is to open a Visual Studio developer command window which has put all of the exectables of Visual Studio on the PATH.