I am new to c++ and dealing with a 'not declared' error

I have just started the c++ course on Codecademy and I have ran into an error message on the “Block Letters” project. I am sure the error is caused by a simple mistake I have made, but with no experience in c++, I can’t seem to resolve it. I am trying to compile and execute my code for step 5 of the project but keep getting the error shown below.

Here is my code:

#include

int main() {

sdt::cout << “N N \n”;

std::cout << “NN N \n”;

std::cout << “N N N \n”;

std::cout << “N NN \n”;

std::cout << “N N \n”;

std::cout << “N N \n”;

std::cout << “N N \n”;

}

The error reads as this:

initials.cpp: In function ‘int main()’:
initials.cpp:6:3: error: ‘sdt’ has not been declared
sdt::cout << “N N \n”;
^~~

Your first line is sdt::cout << “N N \n”;
instead of std::cout << “N N \n”;

Thats why the compiler complained that it didn’t recognize sdt

2 Likes

Thanks for the help!

Also make sure to use #include <iostream> instead of just #include :slight_smile:

1 Like

Hehe they did but the forums markup eats things that look like tags :laughing:. If you want to view code that looks mullered by the forums use the wee ... triple dot near the reply button and the </> symbol to view the raw text that was posted.

For @qwizzzy have a look at this post- How do I format code in my posts? which will keep code your post to the forum nicely formatted :slightly_smiling_face:.

my bad xD

the three dots that bring up the flag, bookmark etc? I don’t see it. Maybe it’s something with user trust levels
¯\(ツ)

Ah you may be right, Oh well, learn something new every day eh :sweat_smile:

thanks anyway if I do find it someday :grin:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.