vendredi 22 avril 2022

C++ compiler versions

Sorry, I'm kind of venting here but it seems I also need to gain some knowledge on compiling versions.

So I have a c++ program (c++ version 11) that compiles normally on my working machine with the command: g++ program.cpp

However, on a different machine it does not compile without specifying the compiler version to c++ 11 using the command: g++ program.cpp -std=c++11

Why do I need to specify the compiler version on a different machine? Why does my working computer allow it to be compiled simply with g++ program.cpp and not the same elsewhere?

I'm asking because I recently turned in an assignment that received a zero because it did not compile.

I left instructions to compile as follows:

Compiler: C++11

Command to compile: g++ program.cpp

Once compiled and ran, the program will prompt you to pick which heuristic you would like to use.

Next the program will prompt you to enter each puzzle piece followed by the enter key.   

I specified the compiler version but I did not include extra -std=c++11 command to specify the version. Assuming the proffesor would be compile the program using the c++ version as stated in the first line of the instructions.

Am I in the wrong here?

Aucun commentaire:

Enregistrer un commentaire