#C++ error setup VScode

21 messages · Page 1 of 1 (latest)

sly wharf
#

I’m trying to run a program to check setup of C++ in VScode. It’s popping up with an error identifier import undefined.
I have a statement import std;
What am i doing wrong?

fair dragon
sly wharf
#

Thanks for response. I am new to programming
Are you intending that my c++ version is older than C++20?

tidal cipherBOT
#

@sly wharf has reached level 1. GG!

fair dragon
#

If you are using G++ then add the command-line parameter -std=c++20 to your g++ command

fair dragon
#

Not sure what you mean

sly wharf
#

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

coarse solstice
#

you didn’t include iostream

sly wharf
#

// 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;
}

sly wharf
#

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

tidal cipherBOT
#

@sly wharf has reached level 2. GG!

fair dragon
#

@sly wharf what compiler and what version of your compiler do you use?

stray sundial
tidal cipherBOT
#

@stray sundial has reached level 1. GG!