Tuples

Hello,
I am trying to compile this code but compiler says that there are some errors here:

|9|error: use of undeclared identifier 'tuple'|
|9|error: expected '(' for function-style cast or type construction|
|10|error: use of undeclared identifier 't1'|
|11|error: use of undeclared identifier 't1'|
|12|error: use of undeclared identifier 't1'|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Could you please explain me why 'tuple' is an undeclared identifier?
I use CodeBlocks on Mac.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#include <tuple>
#include <iostream>
#include <complex>
#include <string>

using namespace std;

int main() {
       tuple<int,float,string> t1(41,6.3,"nico");
       cout << get<0>(t1) << " ";
       cout << get<1>(t1) << " ";
       cout << get<2>(t1) << " ";
       cout << endl;
}
Can you tell what compiler you're currently using?

this code can be compile with g++ (Need to specify c++11 or higher)
Your code runs on the shell: http://cpp.sh/6bsju , so it's a problem with your compiler settings.
On Windows you would set it like this:
Settings->Compiler... ->Compiler Settings -> Compiler Flags -> General choose the second option
[-std=C++11]
I hope it will work on Mac as well.
closed account (48T7M4Gy)
I use CodeBlocks on Mac
Especially because it's a mac, is there any reason why you don't use Xcode?
Thank you everybody, especially Kemort,
now I work in Xcode - everything works great!
closed account (48T7M4Gy)
Excellent and good luck with it, I doubt you'll go back. If you need GUI stuff with a mac Qt Creator is great too. Codeblocks used to be great, wx widgets and all that, but not so much any more. :)
Topic archived. No new replies allowed.