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

Build on Windows with Visual Studio 2017 (Clang toolchain) #753

Closed
iamyaoting opened this issue Jul 22, 2016 · 13 comments
Closed

Build on Windows with Visual Studio 2017 (Clang toolchain) #753

iamyaoting opened this issue Jul 22, 2016 · 13 comments

Comments

@iamyaoting
Copy link

iamyaoting commented Jul 22, 2016

Hello,I install the Visual Studio Update3, but I built it(Dart 6.0) with following error:

2>D:\Projects\Cpp\3rdsource\dart\dart/common/AspectWithVersion.hpp(80): error C2974: 'dart::common::detail::AspectWithState': invalid template argument for 'CompositeT', type expected (compiling source file D:\Projects\Cpp\3rdsource\dart\dart\collision\CollisionGroup.cpp)
2>  D:\Projects\Cpp\3rdsource\dart\dart/common/detail/AspectWithVersion.hpp(48): note: see declaration of 'dart::common::detail::AspectWithState' (compiling source file D:\Projects\Cpp\3rdsource\dart\dart\collision\CollisionGroup.cpp)
2>  D:\Projects\Cpp\3rdsource\dart\dart/dynamics/EndEffector.hpp(57): note: see reference to class template instantiation 'dart::common::AspectWithStateAndVersionedProperties<dart::dynamics::Support,dart::dynamics::detail::SupportStateData,dart::dynamics::detail::SupportPropertiesData,dart::dynamics::EndEffector,dart::dynamics::detail::SupportUpdate,dart::dynamics::detail::SupportUpdate>' being compiled (compiling source file D:\Projects\Cpp\3rdsource\dart\dart\collision\CollisionGroup.cpp)

What's the problem? Can you help me?
Thank you

@jslee02
Copy link
Member

jslee02 commented Jul 22, 2016

The support for Visual Studio 2015 building DART 6.0 has been suspended because of the incomplete constexpr support of VS2015 (#599). However, it seems VS2015 Update 3 has resolved the issue, and there are other build issues as you reported. I'll look into it when having a chance.

@iamyaoting
Copy link
Author

Ok, As you say, in update 3, I did not see the constexpr error.
But the template errors came out.
Thank you~

@mottosso
Copy link

mottosso commented Dec 4, 2016

I can confirm that the same error occurs with Visual Studio 2017 RC1.

C:\Users\marcus\dart\dart\common\AspectWithVersion.hpp(80): error C2974: 'dart::common::detail::AspectWithState': invalid template argument for 'CompositeT', type expected (compiling source file C:\Users\marcus\dart\dart\simulation\Recording.cpp) 

Along with these.

C:\Users\marcus\dart\dart\dynamics\detail\EntityNode.hpp(57): error C2228: left of '.mName' must have class/struct/union (compiling source file C:\Users\marcus\dart\dart\dynamics\SimpleFrame.cpp) 
C:\Users\marcus\dart\dart\dynamics\EntityNode.hpp(65): error C3668: 'dart::dynamics::EntityNode<dart::common::RequiresAspect<dart::common::EmbeddedPropertiesAspect<DerivedT,PropertiesDataT>>>::setName': method with override specifier 'override' did not override any base class methods 
C:\Users\marcus\dart\dart\dynamics\EntityNode.hpp(68): error C3668: 'dart::dynamics::EntityNode<dart::common::RequiresAspect<dart::common::EmbeddedPropertiesAspect<DerivedT,PropertiesDataT>>>::getName': method with override specifier 'override' did not override any base class methods 

@jslee02
Copy link
Member

jslee02 commented Dec 4, 2016

Hm, I'm not sure whether these are bugs of VS or our code has syntactic errors.

@marijnfs
Copy link

Any progress on this issue? Since there are no prebuilt libraries, it seems very constrictive to require a such an old VS for building

@jslee02
Copy link
Member

jslee02 commented Jan 19, 2017

Sorry, no progress yet. I'm still getting the same errors with Visual Studio 2017 RC1 as @mottosso .

@marijnfs
Copy link

For now I compiled the old release (<3) which works. It's annoying though, it seems it's just this one weird template inference problem. There is probably an easy fix, but the strange way templates are used here are a mystery to me.

@jslee02
Copy link
Member

jslee02 commented Mar 8, 2017

Update: Visual Studio 2017 is now available, and AppVeyor seems to support the image for it soon. We could test DART 6.1 on AppVeyor with VS2017 + Clang toolchain at that moment.

@jslee02 jslee02 changed the title Build error with Visual Studio 2015 Update 3 Build on Windows with Visual Studio 2017 (Clang toolchain) Mar 8, 2017
@jslee02
Copy link
Member

jslee02 commented Jan 12, 2018

Resolved by #956

@jslee02 jslee02 closed this as completed Jan 12, 2018
@mgexo
Copy link

mgexo commented May 30, 2018

The original template problem of the author iamyaoting still persists in even in very latest VS2017 version 15.7.2 and git master branch ( DART 7.0.0 ) in code that is supposed to use a cmake compiled version of dart ( also DART 6.6.0 had the same problem ):


1>dart\common\aspectwithversion.hpp(81): error C2974: 'dart::common::detail::AspectWithState': invalid template argument for 'CompositeT', type expected
1>dart\common\detail\aspectwithversion.hpp(50): note: see declaration of 'dart::common::detail::AspectWithState'
1>dart\dynamics\endeffector.hpp(143): note: see reference to class template instantiation 'dart::common::AspectWithStateAndVersionedProperties<dart::dynamics::Support,dart::dynamics::detail::SupportStateData,dart::dynamics::detail::SupportPropertiesData,dart::dynamics::EndEffector,dart::dynamics::detail::SupportUpdate,dart::dynamics::detail::SupportUpdate>' being compiled


Also switching VS2017 to "ISO C++ Latest Draft Standard (/std:c++latest)" does not help.

How exactly (with what version ) did you test that with VS2017 before closing ?
It happens simply when I include this file in code that wants to use dart:
#include <dart/simulation/World.hpp>

Also the dart library shows a huge number of warnings in VS2017 , so I need to use the following:

#pragma warning(disable:4250)
#pragma warning(disable:4244)
#pragma warning(disable:4996)

@mxgrey
Copy link
Member

mxgrey commented May 30, 2018

I think the flag you need in your consumer project is /permissive-.

We should probably make that flag a target_compile_options( ... PUBLIC ...) flag of the DART library so that consumer projects will automatically get it.

Let us know if adding /permissive- to your project doesn't help.

@mxgrey
Copy link
Member

mxgrey commented May 30, 2018

Note that the /std:c++... flag seems to be related to toggling the availability of standard features whereas the /permissive- flag actually affects the way that code gets parsed.

(Edit: Although I suppose some new language features are related to parsing...)

@mgexo
Copy link

mgexo commented May 30, 2018

Indeed you are right, changing in VS2017 the "Conformance mode" in C++/Language to "Yes (/permissive-) " solves that issues.

Thank you very much for the fast answer!

scpeters added a commit to scpeters/ign-physics that referenced this issue Oct 27, 2020
* Build dartsim and test plugins with /permissive- with MSVC
  due to dartsim/dart#753

* Disable C4250 compiler warnings.

* Create unversioned dartsim plugin by copy rather than
  symlink, since symlinks require extra permissions on
  Windows. This copies the TPE approach.

Signed-off-by: Steve Peters <[email protected]>
scpeters added a commit to gazebosim/gz-physics that referenced this issue Nov 3, 2020
* Build dartsim and test plugins with /permissive- with MSVC
  due to dartsim/dart#753

* Disable C4250 compiler warnings.

* Create unversioned dartsim plugin by copy rather than
  symlink, since symlinks require extra permissions on
  Windows. This copies the TPE approach.

* check_test_ran.py: windows compatibility

Signed-off-by: Steve Peters <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants