Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm really frustrated at present in that g++ is throwing up so many errors even on a simple .cpp file. I'm typing: g++ test.cpp at the command line. Thanks in advance for any help. I downloaded g++ from the Software Centre.

#include <iostream>
using namespace std;

int main()
{
    cout << "Hell World" << endl;
}   

These are the first 2 errors when invoking g++ from the command line:

In file included from /usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h:426:0,
             from /usr/include/c++/4.8/iostream:38,
             from test.cpp:8:
/usr/include/x86_64-linux-gnu/c++/4.8/bits/os_defines.h:44:19: error: missing binary   
operator     before token "("
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)

           ^
In file included from /usr/include/c++/4.8/cwchar:44:0,
             from /usr/include/c++/4.8/bits/postypes.h:40,
             from /usr/include/c++/4.8/iosfwd:40,
             from /usr/include/c++/4.8/ios:38,
             from /usr/include/c++/4.8/ostream:38,
             from /usr/include/c++/4.8/iostream:39,
             from test.cpp:8:

/usr/include/wchar.h:74:43: error: missing binary operator before token "("  # if     
defined __cplusplus && __GNUC_PREREQ (4, 4)
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.