crichardson332 / homebrew-crich_brews

Homebrew tap
0 stars 0 forks source link

error: unknown type name 'constexpr' #2

Closed jharrison closed 5 years ago

jharrison commented 5 years ago

While running make on our own SCRIMMAGE project, the compiler encounters this error (among others). Stack Overflow suggests this may be due to MacOS using an older version of the C++ compiler since constexpr was added in version 11.

The standard SCRIMMAGE repo compiles just fine, which suggests that our project isn't using the same compiler flags as SCRIMMAGE proper. What do I need to change?

crichardson332 commented 5 years ago

I made a pull request in scrimmage core that fixes this issue, but since you've already generated your plugin project, you can fix this by editing msgs/CMakeLists.txt. Add the following code just above the set_target_properties function call (should be line 97):

target_compile_features(${LIBRARY_NAME} PRIVATE cxx_std_11)

jharrison commented 5 years ago

Alright, one step closer! Next error (class name changed to MyAutonomyPlugin for privacy):

Scanning dependencies of target MyAutonomyPlugin_plugin
[ 25%] Building CXX object src/plugins/autonomy/MyAutonomyPlugin/CMakeFiles/MyAutonomyPlugin_plugin.dir/MyAutonomyPlugin.cpp.o
[ 28%] Building CXX object src/plugins/autonomy/MyAutonomyPlugin/CMakeFiles/MyAutonomyPlugin_plugin.dir/waypointgenerator.cpp.o
[ 31%] Linking CXX shared library ../../../../plugin_libs/libMyAutonomyPlugin_plugin.dylib
Undefined symbols for architecture x86_64:
  "scrimmage::autonomy::Waypoint::set_quat_tolerance(double)", referenced from:
      scrimmage::autonomy::MyAutonomyPlugin::init(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in MyAutonomyPlugin.cpp.o
  "scrimmage::autonomy::Waypoint::set_position_tolerance(double)", referenced from:
      scrimmage::autonomy::MyAutonomyPlugin::init(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in MyAutonomyPlugin.cpp.o
  "scrimmage::autonomy::Waypoint::Waypoint(double, double, double)", referenced from:
      scrimmage::autonomy::MyAutonomyPlugin::init(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in MyAutonomyPlugin.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [plugin_libs/libMyAutonomyPlugin_plugin.0.0.1.dylib] Error 1
make[1]: *** [src/plugins/autonomy/MyAutonomyPlugin/CMakeFiles/MyAutonomyPlugin_plugin.dir/all] Error 2
make: *** [all] Error 2

Would you prefer I create a new issue for this?

crichardson332 commented 5 years ago

Yeah if you could, that way I can keep track easier.

jharrison commented 5 years ago

Okay, I split it out to a separate issue and did the same with the readlink discrepancy.

crichardson332 commented 5 years ago

Fixed in https://github.com/gtri/scrimmage/pull/182