Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++11 function iota() not supported by nvcc?

I tried to compile this code:-

#include <vector>

using namespace std;

int main() {
    vector<int> v(5);
    iota(v.begin(), v.end(), 0);
}

And I compiled it with this command:-

D:\workspace\test>nvcc main.cpp --std=c++11

(Because without specifying the std I was getting the "identifier iota() not found" error)

And I get this error:-

nvcc warning : The -std=c++11 flag is not supported with the configured host compiler. Flag will be ignored.
main.cpp
main.cpp(7): error C3861: 'iota': identifier not found

How do I specify the C++ standard I want nvcc to use?

Also, compiling host code separately with g++ and device code with nvcc and then linking the objects with nvcc doesn't work. I get this.

like image 931
dtn34- Avatar asked Oct 24 '25 14:10

dtn34-


1 Answers

I think you need to add #include <numeric>. enter image description here

like image 176
Mayfly Avatar answered Oct 26 '25 03:10

Mayfly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!