Passing strings to Vector<string>

I have a class than declares a vector with the following function in it:
Choices(string description, vector<string> choices),
but as you can see I get the following errors while compiling trying to pass the vector its strings.

What expression am I missing?


-------------- Build: Debug in Rpg (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g -c /Documents/CodeBlocks/Rpg/main.cpp -o obj/Debug/main.o
/Documents/CodeBlocks/Rpg/main.cpp:198:57: error: expected expression
Choices("You are in room 1",^(error here){"Go to room 2", "Search"});
^This arrow is formatted wrong so its at the location in the code above also

/Documents/CodeBlocks/Rpg/main.cpp:199:57: error: expected expression
Choices("You are in room 2",^{"Go back to room 1", "Go to room 3"});
^
/Documents/CodeBlocks/Rpg/main.cpp:200:57: error: expected expression
Choices("You are in room 3",^{"Go back to room 2", "Go to room 4"});
^
/Documents/CodeBlocks/Rpg/main.cpp:201:57: error: expected expression
Choices("You are in room 4",^{"Go back to room 3", "Go to room 5"});
^
0 warnings and 4 errors generated.
Process terminated with status 1 (0 minute(s), 0 second(s))
4 error(s), 0 warning(s) (0 minute(s), 0 second(s))



Last edited on
Enable C++11 mode. -std=c++11

See: http://www.cplusplus.com/doc/tutorial/introduction/codeblocks/

Also enable -Wall -Wextra -pedantic-errors
Is there a way to specify c++11 on a server where the file will be located?
If the the C++ compiler used on the server is the Microsoft compiler, nothing special is required.

If it is the GNU (or LLVM) compiler, legacy C++ is the default; you need to compile with something like:
g++ -std=c++11 -O3 -Wall -Wextra -pedantic-errors my_program.cpp
Topic archived. No new replies allowed.