G++

G++ is the C++ frontend to the GNU Compiler Collection (GCC)

Gcc

GCC is the GNU Compiler Collection



Command libraries g

Example

"If you only installed c compiler you would have command gcc but not command g++;g++ is c++ compiler not c compiler"

from question  

Using the g++ C++ compiler from cygwin

"So running the gcc command automatically includes the c standard libraries running g++ automatically includes the c++ standard libraries etc;but notice running gcc does not automatically link in the c++ standard library"

from question  

Trying to compile C++ code on mac

"Also if you use g++ to link the object files it automatically;links in the std c++ libraries gcc does not do this"

from question  

Relationship between gcc, g++, cygwin, and wingw?

Better

Example

"So using g++ is better than gcc"

from question  

Error: unknown type name ‘bool’

"G++ seems to work better than gcc in my experience"

from question  

Code Blocks and SDL output. weird behavior

Use programs link

Example

"Use g++ not gcc;gcc is a c compiler whereas g++ is a c++ compiler"

from question  

Why can't I compile HelloWorld in C++?

"G++ compiler is more strict then gcc compiler"

from question  

C & c++ default global variable linkage, multiple declaration & definition problem

"Use g++ to compile c++ programs it ll link in the standard c++ library;gcc will not"

from question  

Linking <iostream.h> in linux using gcc

Significant structs looser

Example

"Unfortunately g++ packed the structs significantly looser than gcc which caused significant problems sharing objects between c and c++ code"

from question  

Is it possible to subclass a C struct in C++ and use pointers to the struct in C code?

"Btw you should use g++ not gcc when compiling c++ code;there are significant differences even if gcc is sometimes able to compile c++ or fortran code you ll mostly use gcc to compile c code"

from question  

Makefile Dependencies, What Should Be a Dependency?

Tool underneath one

Example

"C++ source files should be compiled by g++ not by gcc;remember that gcc means gnu compiler collection and also contains gfortran and gccgo etc."

from question  

Structure over flexible array member

"Mex is just a tool which calls one underneath and since g++ is the c++ compiler of gcc you should install this one;as far as i know it will still not work because matlab supports only gcc 4.3 not sure about that"

from question  

MATLAB MEX C++ file Compiling error g++ command not found

Others

Example

I have some issues with compiling very simple code with gcc or g++ main.c below

from question  

GCC not able to compile simple C application after downgrade

The g++ version is a little larger than the gcc version but not 100x larger

from question  

How does the size of compiled binaries depend on the used libraries? c/c++

So maybe the answer is that it s c++ code and the fact they compiled the objects with gcc not g++ made you think it was c code;if they only link with g++ then adding preprocessor checks and extern c is useless that only affects preprocessing and compilation at the linking stage that s already done

from question  

Is there an advantage to linking a shared object library from gcc generated objects with g++?

Some distributions chop you might need to more than just gcc package devtools into tons of small packages gcc g++ binutils gdb

from question  

How can I obtain a newer GCC? I don't have root, and can't compile it (memory error)

Since there is only one compiler it is also accurate to call it gcc no matter what the language context;however the term g++ is more useful when the emphasis is on compiling c++ programs

from question  

What is the difference between g++ and gcc?

I also need the .cpp to be compiled with g++ and related cxxflags whereas the .c need to be compiled with gcc and simplier cflags

from question  

Makefile for mixed C/C++ sources

The -wall option asks for almost all warnings the -wextra ask for some more of i strongly recommend compiling with gcc -wall -wextra -g for c code or g++ -wall -wextra -g for c++ code also add other useful options such and the -g option is asking for debug information in dwarf format these days

from question  

Coding in Command Line, what is -Wall?

With this test code gcc produces a diagnostic only for the unsigned member;so although i d also usually prefer unsigned integers for bitfields or for bitwise manipulation g++ is happier and quieter with int here

from question  

How to set all bits of a bitfield member to 1

Using g++ to compile multiple .cpp and .h files in sublime 2;the reason why using .cpp in sublime text fails is gcc does not do

from question  

Cannot compile multiple C++ files using wildcard (*) on Mac, works fine on Windows

The reason for this is gcc essentially says use c rules when driving the tool chain and g++ says use c++ rules when driving the tool chain;g++ knows that to create a working executable it needs to pass -lstdc++ to the linker stage whereas gcc obviously doesn t think this is necessary even though it knew to use the c++ compiler at the compile the source code stage because of the .cc file ending

from question  

GCC dies trying to compile 64bit code on OSX 10.6

If gcc g++ are not installed then you need to install them via homebrew;cmake setup in the cmake settings make sure that both the c and c++ cuda host compilers are set to your install of gcc g++ usually in usr local bin

from question  

OpenCV + CUDA + OSX Mavericks

A more up-to-date g++ gets a more up-to-date g++ right compiling with with usr libexec gcc i686-redhat-linux 4.8.3 cc1plus via g++ -c tst.cpp we get

from question  

Name Mangling in C++

Also use the correct gcc frontend executable g++ will treat .c files like c++ files unless you explicitly tell it not too;so if you are compiling real c then use gcc not g++

from question  

Syntax error with different gcc version?

This is also reproducible with gcc not just g++

from question  

Undefined behaviour or gcc optimization bug

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0