I've recently swithed from borland C++ 5.5 to MinGW. When I try to compile a .c file using gcc it compiles fine, but when I try to compile a .cpp file using gcc it produces a bunch of errors with c++ specific constructs. If I compile .cpp files with g++ then it works fine. My question is should not gcc call appropriate compilers based on the file extensions? Why does it work for .c files and not for .cpp files. As far as I knew gcc stands for GNU Compiler Collection and it should invoke appropriate compilers on its own. Why is it acting just like a C only compiler?
Jump to Post
>As far as I knew gcc stands for GNU Compiler Collection and
>it should invoke appropriate compilers on its own.
It does invoke the appropriate compiler, but gcc doesn't know how to link C++ libraries while g++ does. I'd be willing to bet that the errors you're getting are linker …
All 8 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.