My last question on here had issues that apperently were gcc not the code(code errors were solved and then I noticed issues with gcc ). I have since whipped up a short hello world program that I know is sound to test this:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!" << endl;
}
but gcc still throws errors.
I named the file "test.cpp" and stored it directly in my home folder then tried:
gcc ./test.cpp -o Test
gcc ~/test.cpp -o Test
gcc /home/josh/test.cpp -o Test
All 3 times with and without capitalizing "Test".
Gcc gives the following errors:
/tmp/ccre0DEJ.o: In function `main':
test.cpp:(.text+0xa): undefined reference to `std::cout'
test.cpp:(.text+0xf): 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*)'
test.cpp:(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> > (std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x1c): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/ccre0DEJ.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
My question is: How can I fix Gcc? If not should I try another compiler?
EDIT: I have tried reinstallint gcc and it still fails.