Thank you for reading my question, I searched everywhere on the net and I couldn't find an answer. I have a test (Olympiad in informatic) next week, The programming language that I'll be using is c++, My code gets compiled by a server which then responds whether my answer was true or false (Wrong compilation is considered as false of course), The problem is that I don't have access to the compilation phase so I can not set c++ to be compiled as c++11 (Can't set compilation flags). My question is: Is there is any way I can add flags inside my cpp file (which will be uploaded to the server) to enable the c++11? Can it be done with predecessor with #somthing ? Note: I have no access except to the cpp file, NO makefile, nor anything else. Thank you For your help, i really appreciate it.
Asked
Active
Viewed 2,784 times
0
-
1There isn't a *standard* way to do this, but it can be done with some compilers. For example, MSVC has the `#pragma comment()` directive: http://stackoverflow.com/q/3484434/4200092 – GoBusto Mar 30 '15 at 19:01
-
1@GoBusto: How's that going to help him set C++11 mode? Besides, MSVC doesn't _have_ C++03/C++11/C++14 modes; it just gives you what it gives you. – Lightness Races in Orbit Mar 30 '15 at 19:09
-
I tried the same thing trying to insert a c source file written in c++ to a c project. The compiler supports both, but the makefile was written in such a way that it only copies .c to the target. – user3528438 Mar 30 '15 at 19:18
-
Mind if I ask why you unaccepted my answer? – NathanOliver Jan 21 '16 at 20:42
2 Answers
0
No, there isn't.
You will have to use the C++ standard dictated by the test.

Lightness Races in Orbit
- 378,754
- 76
- 643
- 1,055
0
There isn't a way to set the compilation flags from the code but:
From Wikipedia
On each of the two competition days, the students are typically given three problems which they have to solve in five hours. Each student works on his/her own, with only a computer and no other help allowed, specifically no communication with other contestants, books etc. Usually to solve a task the contestant has to write a computer program (in C, C++ or Pascal, and occasionally FORTRAN and PHP, C++11 is supported starting from IOI 2014, while Java is planned to be added in IOI 2015[2])
Emphasis mine

NathanOliver
- 171,901
- 28
- 288
- 402