Re: 'gcc' vs 'c++' for compiling c++ files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



  While Patrick is right and I agree that you should use the proper
compiler for the given language, it is not true that your assumption
about filenames was wrong.

  The `gcc` command is choosing the compiler for the file based on its
suffix¹. Files ending with “.cc” are among these considered to be C++
sources and they should compile fine with `gcc`.

  Your description confirms that compilation goes ok. What doesn’t is
linking. Compiled files have no language — they’re already compiled —
and therefore `gcc` has no idea that it should do language-specific
magic, like linking against libstdc++.
____
¹ man gcc → the begining of “Options Controlling the Kind of Output”


Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux