Make sure you include fstream. Also, put “std::” before ostream or put “using namespace std” somewhere.
It would help if you posted the code, as right now I’m just guessing based on common mistakes.
I would guess you forgot to include fstream because different compilers may use different header files and it may be the case that g++ has a header file with
// iostream #include <fstream>
While Dev-C++ may have
// iostream // no include for fstream in this file
So you’re accidentally importing the correct header file rather than doing it explicitly.
For header files, I just use this site when I forget which one.
It seems you need to include ostream to get ostream. Probably the same thing for istream.
Related Posts:
- Expression must have class type
- Why use conio.h?
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- Why is enum class preferred over plain enum?
- Why am I getting this redefinition of class error?
- Single class has a Class Redefinition Error
- C++ Linked List Node with class
- (->) arrow operator and (.) dot operator , class pointer
- Separating class code into a header and cpp file
- how to define -std=c++11 as default in g++
- Pointer to incomplete class type is not allowed
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Why am I getting this redefinition of class error?
- Why would we call cin.clear() and cin.ignore() after reading input?
- no default constructor exists for class
- Getting error “a nonstatic member reference must be relative to a specific object” while both member are in the same class
- Error “C++ requires a type specifier for all declarations whilst defining methods”
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- What are the differences between struct and class in C++?
- error C2011: ” : ‘class’ type redefinition
- The compiler is complaining about my default parameters?
- C++ Linked List Node with class
- Getting error: ISO C++ forbids declaration of with no type
- “used without template parameters”
- Reading from .txt file into two dimensional array in c++
- expected constructor, destructor, or type conversion before ‘(’ token
- C++ Class ‘undeclared identifier”
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- Base class undefined
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- What is the meaning of a C++ Wrapper Class?
- Does C++11 have C#-style properties?
- G++ undefined reference to class::function
- Creating an instance of class
- expected primary-expression before ‘]’ token
- Using cin to input a single letter into a char
- Multiple inputs on one line
- error C2039: ‘string’ : is not a member of ‘std’, header file problem
- Struct with template variables in C++
- error: no member function declared in class
- Here is some error with my .h file which show [Error] unterminated #ifndef when I include my class template in it
- Error: invalid use of member in static member function
- How to create a dynamic array of integers
- How to implement 2D vector array?
- What is the difference between g++ and gcc?
- What’s the C++ version of Java’s ArrayList
- What is the difference between “long”, “long long”, “long int”, and “long long int” in C++?
- ‘g++’ is not recognized as an internal or external command, operable program or batch file
- How do I convert a double into a string in C++?
- How to create timer events using C++ 11?
- How to concatenate two strings in C++?
- ‘g++’ is not recognized as an internal or external command, operable program or batch file
- Read file line by line using ifstream in C++
- Virtual/pure virtual explained
- error: lvalue required as unary & operand
- C/C++ JSON parser
- C++ Parsing input string to variables
- ‘cout’ was not declared in this scope
- Segmentation fault error 11 C++
- Why doesn’t C++ have a garbage collector?
- How does ifstream’s eof() work?
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- libstdc++-6.dll not found
- vector
::size_type in C++ - What does ‘\0’ mean?
- cin >> “no operator matches these operands”
- C++ on mac : linker command failed with exit code 1 (use -v to see invocation)
- Correct way to use cin.fail()
- Destructor for a linked List
- Why use a new call with a C++ ‘vector’?
- Arduino sprintf float not formatting
- How to end C++ code
- Delete 2D array C++
- class not declared in scope – even though .h was included
- Best C/C++ Network Library
- How to check that an element is in a std::set?
- C++ string to enum
- why is string not declared in scope
- How does rhs work?
- error: expected unqualified-id before ‘.’ token //(struct)
- C++ – Assigning null to a std::string
- C++ Return value, reference, const reference
- Is string::compare reliable to determine alphabetical order?
- How to return a struct from a function in C++?
- C++ printing boolean, what is displayed?
- Error : aggregate ‘first one’ has incomplete type and cannot be defined
- CMake : C and CXX compiler identification is unknown Win10 CMakeGUI
- Error “Unterminated conditional directive” in cross-referencing headers
- Error in assignment of member in read-only object
- creating an array of structs in c++
- What’s the Use of ‘\r’ escape sequence?
- How do I use an enum value in a switch statement in C++?
- Why should I use a pointer rather than the object itself?
- Call of overloaded function is ambiguous
- ‘cout’ does not name a type
- C++ Cannot call constructor directly in small example
- C++ compiler error c4430 “c++ doesnt support default int”
- Difference between the int * i and int** i
- Download c++ in existing visual studio 2017
- “Incomplete type not allowed ” when creating std::ofstream objects