Compile the program with:
g++ -Wall -Wextra -Werror -c main.cpp -o main.o ^^^^^^^^^^^^^^^^^^^^ <- For listing all warnings when your code is compiled.
as cout
is present in the C++ standard library, which would need explicit linking with -lstdc++
when using gcc
; g++
links the standard library by default.
With gcc
, (g++
should be preferred over gcc
)
gcc main.cpp -lstdc++ -o main.o
Related Posts:
- error: use of deleted function
- What is the difference between g++ and gcc?
- What is a lambda expression in C++11?
- ld: symbol(s) not found for architecture x86_64 error
- g++ ld: symbol(s) not found for architecture x86_64
- How do I print out the contents of a vector?
- What is the ‘override’ keyword in C++ used for? [duplicate]
- What is a smart pointer and when should I use one?
- Meaning of = delete after function declaration
- C++ std::priority_queue uses the lambda expression
- Usage and Syntax of std::function
- Convert char to int in C and C++
- What exactly is nullptr?
- Difference between `constexpr` and `const`
- Split a string using C++11
- How to create timer events using C++ 11?
- How does #include
work in C++? - Undefined reference to vtable
- Expected initializer before function name
- Inheriting constructors
- ‘cout’ was not declared in this scope
- What does T&& (double ampersand) mean in C++11?
- ‘cout’ was not declared in this scope
- C++ table alignment – cout and iomanip
- Segmentation fault error 11 C++
- Undefined reference to vtable
- Why doesn’t C++ have a garbage collector?
- C ++ error: a expected initializer before [function name]
- Inheriting constructors
- Compiling C++11 with g++
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- What exactly is std::atomic?
- Issue with std::stol – ‘std::invalid_argument’ what(): stol
- terminate called after throwing an instance of ‘std::out_of_range’
- Cleanest way to copy a constant size array in c++11
- push_back vs emplace_back
- What is move semantics?
- expression preceding parentheses of apparent call must have (pointer-to-) function type
- C++ error: Undefined symbols for architecture x86_64
- C++ terminate called without an active exception
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- MinGW: “gcc is not recognized as an internal or external command”
- Thread pooling in C++11
- How does std::forward work? [duplicate]
- Compiling a C++ program with gcc
- Difference in make_shared and normal shared_ptr in C++
- What is std::move(), and when should it be used?
- C++: std does not have member “string”
- push_back vs emplace_back
- gcc/g++: “No such file or directory”
- Call to implicitly deleted copy constructor in LLVM
- CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- cannot declare variable ‘’ to be of abstract type ‘’
- how to print a string to console in c++
- Debug vs Release in CMake
- Debug vs Release in CMake
- error C2679: binary ‘<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
- no match for ‘operator<<’ in ‘std::operator
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- Use the auto keyword in C++ STL
- What does the fpermissive flag do?
- gcc: undefined reference to
- Call to non-static member function without an object argument compiler error
- Does C++11 have C#-style properties?
- Why I cannot cout a string?
- Update GCC on OSX
- C++ printing boolean, what is displayed?
- Iterator Loop vs index loop
- GCC -fPIC option
- initialize a vector to zeros C++/C++11
- When is it safe to call this-> in constructor and destructor
- How to memset char array with null terminating character?
- gcc -g :what will happen
- How well is Unicode supported in C++11?
- How to automatically convert strongly typed enum into int?
- Why should I use a pointer rather than the object itself?
- too many initializers for ‘int [0]’ c++
- Warning : overflow in implicit constant conversion
- overloaded function with no contextual type information
- Creating folders in C++
- cc1.exe System Error – libwinpthread-1.dll missing – But it isn’t
- convert string to size_t
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- How to Check the Version of my gcc?
- Make / gcc cryptic error 2: how to have more information?
- Compiling C++11 with g++
- Linker error: “linker input file unused because linking not done”, undefined reference to a function in that file
- ERROR C2039: ‘vector’: is not a member of ‘std’
- Does static constexpr variable inside a function make sense?
- c++ vector bubble sort
- How to use bitmask?
- Differences between unique_ptr and shared_ptr
- What is the effect of extern “C” in C++?
- C++ – Decimal to binary converting
- Alternative to itoa() for converting integer to string C++?
- What does “missing template argument” mean?
- Random not declared in scope
- What does the “Expected ‘(‘ for function-style cast or type construction” error mean?
- C++ operator+ and operator+= overloading