I have been able to use OpenGL’s glVertexPointer function using the following C++ code:
glVertexPointer(3, GL_DOUBLE, 0, myMeasuredPoints.data());
myMeasuredPoints is a C++ vector with elements of type double. When compiling this code with Visual C++, there is no problem at all. However, when using MinGW to compile, I get the following error:
error: 'class std::vector<double, std::allocator<double>' has no member named 'data'
Strangely, I do not get this error any other place in the code where I invoke functions such as myMeasuredPoints.push_back() to push values onto the vector. These other instances have all been before using the .data() function, so it hasn’t simply been a case of the code crashing before reaching the other instances.
Any thoughts?
The
datafunction was added in C++11. Make sure you compile with-std=c++0xor-std=c++11and have a version of MinGW that includes the function.If that’s not possible, you can use the usual C++03 variant: