mardi 21 avril 2015

Unrecognized command line in C++11

I ran the following program but I dont know why am I getting the following error: error: unrecognized command line option ‘-std=c++11’. My gcc version is 4.6 and I have set c++ compiler in netbeans to c++11.

#include <cstdlib>
#include <algorithm>
using namespace std;

template<class T>
void parallel_sort(T* data, int len, int grainsize)
{
    if(len < grainsize) // Use grainsize instead of thread count so that we don't e.g. spawn 4 threads just to sort 8 elements.
    {
        std::sort(data, data + len, std::less<T>());
    }
    else
    {

        parallel_sort(data + len/2, len/2, grainsize); // No need to spawn another thread just to block the calling thread which would do nothing.

        std::inplace_merge(data, data + len/2, data + len, std::less<T>());
    }
}

int main(int argc, char** argv) {

    return 0;
}

Aucun commentaire:

Enregistrer un commentaire