Support #1618

Compile Error when trying to initialize RealVector from value list

Added by D. Seidel over 10 years ago. Updated over 10 years ago.

Status:RejectedStart date:09/09/2013
Priority:UrgentDue date:
Assignee:-% Done:

0%

Category:-
Target version:NemoMath 0.4

Description

I am stuck at trying to initialize a RealVector directly with values (this is in in the FlexIRobConfig.h context, therefore this is mandatory).

I attach a minimalistic example producing the compile error, which I am not able to fix by myself.

$ g++ -std=c++0x -o test.o test.cpp
test.cpp: In function ‘int main()’:
test.cpp:4:92: error: could not convert ‘{0.0, 2.0e+1, 0.0, -6.5e+1, 0.0, 9.0e+1, 0.0}’ from ‘<brace-enclosed initializer list>’ to ‘const nemo::MathVector<double>’

test.cpp:

#include "/vol/toolkit/nightly/x86_64/successful/include/NemoMath0.4/nemo/Vector.h" 

int main() {
    static const nemo::MathVector<double> home_values = {0.0, 20.0, 0.0, -65.0, 0.0, 90.0, 0.0};
    return 0;
}

g++ is the standard version deployed with netboot.
$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

test.cpp Magnifier (205 Bytes) D. Seidel, 09/09/2013 05:21 PM

History

#1 Updated by C. Emmerich over 10 years ago

  • Priority changed from Normal to Urgent

#2 Updated by Anonymous over 10 years ago

  • Status changed from New to Rejected
  • Assignee set to Anonymous
  • Target version set to NemoMath 0.4

This is probably a misconfiguration of your project. When using nemomath with c++0x features, nemomath will export the necessary compiler flags in its variable ${NEMOMATH_DEFINITIONS}, which is -std=c++0x -DNEMO_HAS_CPP0x(!). You have to use these definitions in your downstream project (add_definitions(${NEMOMATH_DEFINITIONS})).

In other words, in your example

g++ -std=c++0x -DNEMO_HAS_CPP0x -o test test.cpp && ./test

will do the trick.

Also available in: Atom PDF