Article 5DNXQ [C++] What is not installed here? (I cannot include "iostream", gcc complains strangely)

[C++] What is not installed here? (I cannot include "iostream", gcc complains strangely)

by
dedec0
from LinuxQuestions.org on (#5DNXQ)
I thought the gcc i have installed had everything to basic (at least) C++ programs. But look at this:

File a.cpp:

Code:#include <iostream>
#include <cstdlib>

int main()
{
return 0;
}Compiled with:

Code:gcc -ggdb -Wall a.cppReturns:

Code:/tmp/ccHxsgn8.o: In function
`__static_initialization_and_destruction_0(int, int)':
/usr/include/c++/6/iostream:74: undefined reference to
`std::ios_base::Init::Init()'
/usr/include/c++/6/iostream:74: undefined reference to
`std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit statusAnd the file we get removing the first line, with the iostream library include, outputs no error, compiles perfectly.

One command output:

Code:$ gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.It is not a problem on my machine. I remotely accessed an university computer which is used by Computer Science students, mainly, and there also cannot use "#include <iostream>" in programs. What is wrong here??? iostream is so basic in C++!latest?d=yIl2AUoC8zA latest?i=MJGwZQ8UrCU:AUSstLkFf0s:F7zBnMy latest?i=MJGwZQ8UrCU:AUSstLkFf0s:V_sGLiP latest?d=qj6IDK7rITs latest?i=MJGwZQ8UrCU:AUSstLkFf0s:gIN9vFwMJGwZQ8UrCU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments