Confusing error message for c++ sources

Bug #39870 reported by Tero Karvinen
6
Affects Status Importance Assigned to Milestone
gcc-defaults (Ubuntu)
Invalid
Medium
Matthias Klose

Bug Description

When trying to compile C++ files with 'gcc', a confusing screenfull of weird error messages is given. Instead, it should say something like "To compile C++ files, use g++. For example: 'g++ hello.cc'.

To reproduce:
1) $ cat hello.cc
#include <iostream>
int main(int argc, char *argv[])
{
        std::cout << "Hello C++ world!" << std::endl;
        return 0;
}
2) $ gcc hello.cc
/tmp/ccI0YbBc.o: In function `main':
[..]
std::operator<< <std::char_traits<char> >(std::basic_ostream<char, [..]
collect2: ld returned 1 exit status

Revision history for this message
Matthias Klose (doko) wrote :

note, that the files is correctly compiled; the linking fails. either you add -lstdc++, or just call g++.

Changed in gcc-defaults:
assignee: nobody → doko
status: Unconfirmed → Rejected
Revision history for this message
Tero Karvinen (karvinen+launchpad) wrote :

You said it: "just call g++". Wouldn't it be nice if gcc could say this to users too?

The last line of the error message could be:

 Did you mean: g++ [file.cc]

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.