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

API miss-matching #3

Closed
wyqsnddd opened this issue Oct 9, 2019 · 5 comments
Closed

API miss-matching #3

wyqsnddd opened this issue Oct 9, 2019 · 5 comments
Labels

Comments

@wyqsnddd
Copy link

wyqsnddd commented Oct 9, 2019

Hi Vincent!

I met the following problem during compilation:

[ 33%] Building CXX object src/CMakeFiles/wcl.dir/ContactSurface.cpp.o
cd /home/yuquan/local/wrench-cone-lib/build/src && /usr/bin/c++  -D_USE_MATH_DEFINES -Dwcl_EXPORTS -I/home/yuquan/local/wrench-cone-lib/build -I/home/yuquan/local/wrench-cone-lib/build/include -I/home/yuquan/local/wrench-cone-lib/include -I/home/yuquan/local/wrench-cone-lib/src -isystem /usr/local/include/eigen3  -Werror  -pedantic -Wno-long-long -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wwrite-strings -Wconversion  -O2 -g -DNDEBUG -fPIC   -Dwcl_EXPORTS -std=gnu++11 -o CMakeFiles/wcl.dir/ContactSurface.cpp.o -c /home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp
/home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp: In function ‘wcl::ContactSurface wcl::rectangularSurface(double, double, const Vector3d&, const Matrix3d&, double, unsigned int)’:
/home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp:32:73: error: no matching function for call to ‘wcl::ContactSurface::ContactSurface(<brace-enclosed initializer list>)’
     return wcl::ContactSurface({position, rotation, p, mu, nrGenerators});
                                                                         ^
In file included from /home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp:19:0:
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note: candidate: wcl::ContactSurface::ContactSurface()
 struct WCL_DLLAPI ContactSurface {
                   ^
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note:   candidate expects 0 arguments, 1 provided
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note: candidate: wcl::ContactSurface::ContactSurface(const wcl::ContactSurface&)
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const wcl::ContactSurface&’
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note: candidate: wcl::ContactSurface::ContactSurface(wcl::ContactSurface&&)
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘wcl::ContactSurface&&’
src/CMakeFiles/wcl.dir/build.make:65: recipe for target 'src/CMakeFiles/wcl.dir/ContactSurface.cpp.o' failed
make[2]: *** [src/CMakeFiles/wcl.dir/ContactSurface.cpp.o] Error 1
make[2]: Leaving directory '/home/yuquan/local/wrench-cone-lib/build'
CMakeFiles/Makefile2:1300: recipe for target 'src/CMakeFiles/wcl.dir/all' failed
make[1]: *** [src/CMakeFiles/wcl.dir/all] Error 2
make[1]: Leaving directory '/home/yuquan/local/wrench-cone-lib/build'
Makefile:143: recipe for target 'all' failed
make: *** [all] Error 2

Could you suggest a fix please?

Best,

Yuquan

@vsamy
Copy link
Owner

vsamy commented Oct 10, 2019

It works perfetly on my side. What compiler do you use? You can eventually add set(CMAKE_CXX_STANDARD 11) in the cmake.

You can also try this:

return { position, rotation, p, mu, nrGenerators };

or this

return wcl::ContactSurface{position, rotation, p, mu, nrGenerators};

@vsamy vsamy added the bug label Oct 10, 2019
@wyqsnddd
Copy link
Author

Actually I already added set(CMAKE_CXX_STANDARD 11) but I still have the issue. I am using ubuntu 16.04 and

gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I tried both of the modifications but end up with errors:
1.

return { position, rotation, p, mu, nrGenerators };
In function ‘wcl::ContactSurface wcl::rectangularSurface(double, double, const Vector3d&, const Matrix3d&, double, unsigned int)’:
/home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp:33:71: error: no matching function for call to ‘wcl::ContactSurface::ContactSurface(<brace-enclosed initializer list>)’
     return wcl::ContactSurface{position, rotation, p, mu, nrGenerators};
                                                                       ^
In file included from /home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp:19:0:
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note: candidate: wcl::ContactSurface::ContactSurface()
 struct WCL_DLLAPI ContactSurface {
                   ^
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note:   candidate expects 0 arguments, 5 provided
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note: candidate: wcl::ContactSurface::ContactSurface(const wcl::ContactSurface&)
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note:   candidate expects 1 argument, 5 provided
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note: candidate: wcl::ContactSurface::ContactSurface(wcl::ContactSurface&&)
/home/yuquan/local/wrench-cone-lib/include/wcl/ContactSurface.h:30:19: note:   candidate expects 1 argument, 5 provided
src/CMakeFiles/wcl.dir/build.make:65: recipe for target 'src/CMakeFiles/wcl.dir/ContactSurface.cpp.o' failed
make[2]: *** [src/CMakeFiles/wcl.dir/ContactSurface.cpp.o] Error 1
make[2]: Leaving directory '/home/yuquan/local/wrench-cone-lib/build'
CMakeFiles/Makefile2:1300: recipe for target 'src/CMakeFiles/wcl.dir/all' failed
make[1]: *** [src/CMakeFiles/wcl.dir/all] Error 2
make[1]: Leaving directory '/home/yuquan/local/wrench-cone-lib/build'
Makefile:143: recipe for target 'all' failed
make: *** [all] Error 2
return wcl::ContactSurface{position, rotation, p, mu, nrGenerators};
/home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp: In function ‘wcl::ContactSurface wcl::rectangularSurface(double, double, const Vector3d&, const Matrix3d&, double, unsigned int)’:
/home/yuquan/local/wrench-cone-lib/src/ContactSurface.cpp:34:54: error: could not convert ‘{position, rotation, p, mu, nrGenerators}’ from ‘<brace-enclosed initializer list>’ to ‘wcl::ContactSurface’
     return { position, rotation, p, mu, nrGenerators };
                                                      ^
src/CMakeFiles/wcl.dir/build.make:65: recipe for target 'src/CMakeFiles/wcl.dir/ContactSurface.cpp.o' failed
make[2]: *** [src/CMakeFiles/wcl.dir/ContactSurface.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/yuquan/local/wrench-cone-lib/build'
CMakeFiles/Makefile2:1300: recipe for target 'src/CMakeFiles/wcl.dir/all' failed
make[1]: *** [src/CMakeFiles/wcl.dir/all] Error 2
make[1]: Leaving directory '/home/yuquan/local/wrench-cone-lib/build'
Makefile:143: recipe for target 'all' failed
make: *** [all] Error 2

@vsamy
Copy link
Owner

vsamy commented Oct 10, 2019

Ok, it is due to the default initialization of the ContactSurface.

@vsamy
Copy link
Owner

vsamy commented Oct 10, 2019

GCC 5.4 is quite old, this behavior is solved from GCC 5.5 actually.
Try this:

wcl::ContactSurface rectangularSurface(.....)
{
    std::vector<Eigen::Vector3d> p;
    // all the emplace_back
#if defined(__GNUC__) && (__GNUC___ <= 5 && __GNUC_MINOR__ <= 4)
    wcl::ContactSurface cs;
    cs.position = position;
    cs.rotation = rotation;
    cs.points = std::move(p);
    cs.mu = mu;
    cs.nrGenerators = nrGenerators;
    return cs;
#else
    return { p, 0.2, 10 };
#endif
}

If it works, i will patch.

@wyqsnddd
Copy link
Author

Good! It works on my side too, excellent!

@vsamy vsamy closed this as completed in e3b89a5 Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants