Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax errors when integrating into Visual Studio project [13361] #2300

Closed
ghostravenstorm opened this issue Nov 1, 2021 · 4 comments · Fixed by #2383
Closed

Syntax errors when integrating into Visual Studio project [13361] #2300

ghostravenstorm opened this issue Nov 1, 2021 · 4 comments · Fixed by #2383

Comments

@ghostravenstorm
Copy link

When integrating Fast-DDS as a third party library in Visual Studio, the IDE complains about various syntax errors in the FastRTPS source.

Expected Behavior

If installed correctly without errors, there should be no compile errors when adding FastDDS includes to a Visual Studio project.

Current Behavior

When including <fastrtps/Domain.h> in a file in a Visual Studio C++ UWP project, the VS compiler throws several syntax errors preventing a Hello World project from building.

Steps to Reproduce

  1. Install FastDDS 2.1.0 on Windows following the readme instructions; manual build using CMake.
  2. Create a Blank App (Universal Windows - C++/CX) project in Visual Studio.
  3. Add all the FastDDS include paths under Compiler options and all the FastDDS libs under Linker options.
    image
    image
  4. Add #include <fastrtps/Domain.h to the App.xaml.cpp file.
  5. Build the solution and observe several syntax errors.
Build started...
1>------ Build started: Project: WhiteWolf, Configuration: Debug Win32 ------
1>pch.cpp
1>App.xaml.cpp
1>MainPage.xaml.cpp
1>XamlTypeInfo.Impl.g.cpp
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(173,7): warning C4003: not enough arguments for function-like macro invocation 'max' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(183,7): warning C4003: not enough arguments for function-like macro invocation 'min' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(283,71): warning C4003: not enough arguments for function-like macro invocation 'max' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(335,23): warning C4003: not enough arguments for function-like macro invocation 'max' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(388,72): warning C4003: not enough arguments for function-like macro invocation 'max' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(173,7): error C2059: syntax error: ')' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(570): message : see reference to class template instantiation 'eprosima::fastrtps::BitmapRange<T,Diff,NBITS>' being compiled (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(173,1): error C2334: unexpected token(s) preceding ':'; skipping apparent function body (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(570,1): error C2143: syntax error: missing ')' before ';' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(570,1): error C2059: syntax error: ')' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(570,1): error C2238: unexpected token(s) preceding ';' (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\fastrtps\include\fastrtps\utils\fixed_size_bitmap.hpp(570,1): fatal error C1201: unable to continue after syntax error in class template definition (compiling source file App.xaml.cpp)
1>C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The "CompileXaml" task returned false but did not log an error.
1>Done building project "WhiteWolf.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

System information

Windows 10 21H1, Boost 1.77.0, Fast-DDS 2.1.0, Visual Stuio 2019 16.11.5

@ghostravenstorm
Copy link
Author

I tried an instillation on Windows from binaries, and that install method more or less generates the same syntax errors from fastrtps sources. It's also not clear if I'm referencing dependencies in my project correctly. There's a surprising lack of documentation on how to setup a Visual Studio project to use FastDDS.

@MiguelCompany
Copy link
Member

MiguelCompany commented Jan 3, 2022

@ghostravenstorm Sorry for the late response.

I think this has been solved by #1746, but it has not been backported to 2.1.x yet (I just created it in #2383).
Could you check if applying the changes of bd4db1b solves your issue?

@MiguelCompany MiguelCompany changed the title Syntax errors when integrating into Visual Studio project Syntax errors when integrating into Visual Studio project [13361] Jan 3, 2022
@JLBuenoLopez
Copy link
Contributor

I am going to close this issue due to inactivity. A fix has been proposed but no feedback from the user has been received. @ghostravenstorm, feel free to reopen if the issue is still happening after the fix.

@zixuan-su
Copy link

hello , when I use Visual Studio , a similar error was encountered,。 Do you now know how to configure fastdds in VS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants