mercredi 30 novembre 2016

C++ code working on terminal but not with codeblocks

I have the following c++ code :

set<pair<int,int> > setCouple = c.cartesianProduct(d);
    typename set<pair<int,int> >::iterator it;

    for(it =setCouple.begin(); it!= setCouple.end(); ++it) {
        cout << get<0>(*it)<< ", " << get<1>(*it)  << endl;
    }
}

This code is perfectly compiling and running when i compile it with the following command line :

clear;clear;g++ -Wall -Weffc++ -std=c++11 *.cpp -o a

But when i want to build it in codeblock (on debian) i have this error :

error: ‘template struct std::pair’ used without template parameters|

And this error as well :

error: no match for ‘operator<<’ (operand types are ‘const std::pair’ and ‘const char [3]’)|

When i intalled debian i selected the gcc compiler.

Why do i have these 2 error only when i want to comile and run on CodeBlock ? In the future i would like to code on an IDE for C++, will i have these kind of problem (code that works on command line but not in IDE) frequently ?

Aucun commentaire:

Enregistrer un commentaire