Похожие чаты

Hi every one, I get the error "ofstream' was not declared

in this scope", when I compile this code,
https://hastebin.com/dutupobowa.cpp
does anybody know the reason?

12 ответов

11 просмотров

using namespace std; is missing.

Paria.-Z Автор вопроса

You should use std::ofstream. Never use using namespace std please, it’s super bad practice

Paria.-Z Автор вопроса
Paria. Z
Why? It works most of the time

Because explicit namespaces makes code clearer

Paria. Z
Why? It works most of the time

You pollute the namespaces and then calls to functions with same name but different namespace appear ambiguous

Paria.-Z Автор вопроса
rc_05
You pollute the namespaces and then calls to funct...

Thx when I put Using namespace std out of the main Function, the problem was solved

Anonymous ...
But why?

polluting namespaces bad

Anonymous ...
But why?

Because you’re polluting your namespace with everything from the std namespace. Ask most anyone that has been using C++ for any length of time. It’s bad practice.

Похожие вопросы

Обсуждают сегодня

Карта сайта