>gcc my.cpp
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\VENKAT~1\AppData\Local\Temp\cccMqWsr.o:my.cpp:(.text+0x19): undefined reference to `std::cout'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\VENKAT~1\AppData\Local\Temp\cccMqWsr.o:my.cpp:(.text+0x1e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\VENKAT~1\AppData\Local\Temp\cccMqWsr.o:my.cpp:(.text+0x35): undefined reference to `std::ios_base::Init::~Init()'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\VENKAT~1\AppData\Local\Temp\cccMqWsr.o:my.cpp:(.text+0x56): undefined reference to `std::ios_base::Init::Init()'
collect2.exe: error: ld returned 1 exit status
Asked
Active
Viewed 109 times
-1
-
1Use `g++` not `gcc` for compiling and linking c++ code – Alan Birtles Jun 22 '20 at 03:34
-
Please don't tag your IDE or code editor unless your question is specifically related to the editor itself. – MattDMo Jun 22 '20 at 17:12
1 Answers
1
is it just me, or your trying to use a C compiler to compile a C++ program try using g++ instead

Edwin Chew
- 49
- 1
- 4
-
-
1Yes, gcc is a C compiler. .cpp is a C++ file , so i am assuming your writing C++ code. C != C++ std::cout does not exist in C, try stdio libraries or compile using a C++ compiler – Edwin Chew Jun 22 '20 at 02:24