Visual Studio 2019 Fails to Compile

3 posts / 0 new
Last post
Offline
Last seen: 1 year 11 months ago
Joined: 09/06/2022
Posts: 2
Visual Studio 2019 Fails to Compile

I am trying to build the hello world programs in Visual Studio 2019. I get the following errors:

2>------ Rebuild All started: Project: hello_world_subscriber, Configuration: Debug DLL x64 ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(513,5): warning MSB8028: The intermediate directory (.\objs\x64Win64VS2017\) contains files shared from another project (hello_world_publisher.vcxproj). This can lead to incorrect clean and rebuild behavior.
2>hello_world_subscriber.cxx
2>C:\Users\n7699e\rti_connext_dds-6.1.1\include\ndds\hpp\rti\core\detail\NativeSequence.hpp(27,10): fatal error C1083: Cannot open include file: 'ndds/ndds_c.h': No such file or directory
2>hello_worldPlugin.cxx
2>C:\Dev\C++Projects\rticonnextdds-getting-started\2_hello_world\c++11\hello_worldPlugin.cxx(15,10): fatal error C1083: Cannot open include file: 'ndds/ndds_cpp.h': No such file or directory
2>hello_world.cxx
2>C:\Dev\C++Projects\rticonnextdds-getting-started\2_hello_world\c++11\hello_world.cxx(15,10): fatal error C1083: Cannot open include file: 'ndds/ndds_cpp.h': No such file or directory
2>hello_worldSupport.cxx
2>C:\Dev\C++Projects\rticonnextdds-getting-started\2_hello_world\c++11\hello_world.h(18,10): fatal error C1083: Cannot open include file: 'ndds/ndds_cpp.h': No such file or directory
2>Generating Code...
2>Done building project "hello_world_subscriber-x64Win64VS2017.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ==========

Under Properties, I added the following to Additional Include Directories:

C:\Users\n7699e\rti_connext_dds-6.1.1\include\ndds\
C:\Users\n7699e\rti_connext_dds-6.1.1\include\ndds\dds_c\
C:\Users\n7699e\rti_connext_dds-6.1.1\include\ndds\hpp\

In actuality I use $(CONNEXTDDS_DIR)\include\ndds\hpp\ based on Environment Variables.

It is also looking for hello_world.hpp, where the solution file includes hello_world.h. I just changed the name to make them the same.

As usual, I am having problems with M$ VS 2019, and I wish I could be using Linux. Alas, I cannot...

 

Thank you in advance for any assistance,

William Peloquin

 

Organization:
Offline
Last seen: 1 year 11 months ago
Joined: 09/06/2022
Posts: 2

Well, I found the reason for the problem. I was putting the output into the C++11 directory data, not the C++98 directory.

rtiddsgen -language c++ -platform %CONNEXTDDS_ARCH% -create makefiles -create typefiles -d c++11 -ppDisable hello_world.idl

When I changed to: rtiddsgen -language c++ -platform %CONNEXTDDS_ARCH% -create makefiles -create typefiles -d c++98 -ppDisable hello_world.idl 
it worked.

I am using VS 2019, so I thought it would be using modern C++ (version 11).

Howard's picture
Offline
Last seen: 1 day 15 hours ago
Joined: 11/29/2012
Posts: 605

Which version of the Connext DDS C++ API that you want to use is your choice.  Connext supports both Modern (aka C++11) and Traditional (aka C++ or C++98) APIs.  You use one or the other in coding your application.

The header files will be different depending on which version of C++ that you use.

When you use "rtiddgen", the "-language" argument tells "rtiddsgen" for which language that you want the code to be generated.  Options include "C", "Java", "C#", and of course "C++" and "C++11". "C++" (or "c++") is the traditional C++ API.  "C++11" (or "c++11") is the modern C++ API.

What language is used to generate the code is independent of the compiler that you use to compile the code...of course if using C++11, you have to have compiler that supports the C++11 standard.

But a compiler such as MSVS 2019 supports both C++11 and C++98, though you should not mix calls to both Connext DDS APIs in the same program.