I am learning to code in college and working on a voting program. I have resolved some of the issues I've had with VS code by simply qualifying the namespace before all appropriate lines with 'std::' however for the sake of user-friendliness and just a general feel I wanted to be able to pause the execution of the program for a set period. I have used the 'chrono' and 'thread' headers to achieve this through the following: std::this_thread::sleep_for (std::chrono::seconds (2));
The above line of code produces the following error message under the problems tab: name followed by '::' must be a class or namespace name When I try to compile I receive the following error message under the terminal tab: filename.cpp:162:8: error: 'std::this_thread::sleep_for (std::chrono::seconds(2));
The appropriate libraries have been included i.e. 'thread' and 'chrono'.
Other libraries included are: ios, string, limits, vector, cctype, fstream, cstring, iomanip and iostream
I have also updated my "code-runner.executorMap" to support C++11 with the following line of code:
"cpp": "cd $dir && g++ -std=c++11 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
I've ran the code using an online compiler with no errors and it works as expected with the program pausing for two seconds however in VS Code I cannot even compile it due to the error.
Aucun commentaire:
Enregistrer un commentaire