#C++ error setup VScode
21 messages · Page 1 of 1 (latest)
Probably because you are not compiling for C++20 currently but having a import declaration
Thanks for response. I am new to programming
Are you intending that my c++ version is older than C++20?
How can i overcome this?
@sly wharf has reached level 1. GG!
If you are using G++ then add the command-line parameter -std=c++20 to your g++ command
Is it this, g++ -std=c++20?
Not sure what you mean
I’m trying to setup C++ in VScode
Trying to learn C++ from Programming: Principles and Practice Using C++ by Bjarne
When i execute import std; vscode pops up with error
you didn’t include iostream
// This program outputs the message "Hello, World!" to the monitor
import std; // gain access to the C++ standard library
int main() // C++ programs start by executing the function main
{
std::cout << "Hello, World!\n"; // output "Hello, World!"
return 0;
}
This is the program I'm trying to execute. This should work for C++20 or higher. Problem is I'm unable to setup VSCODE for that
Unable to find solution
I really wanted to start my C++ journey lol
Maybe I should use books that contain lower c++ standard or something
@sly wharf has reached level 2. GG!
@sly wharf what compiler and what version of your compiler do you use?
g++ 14.2.0
@stray sundial has reached level 1. GG!