How to compile C++ is_pod?

Christopher Jones jonesc at hep.phy.cam.ac.uk
Sun Dec 1 16:17:59 PST 2013


Hi,

you are compiling it incorrectly (Its C++ code, not C). Use 'g++-mp-4.7’.

Chris

On 1 Dec 2013, at 7:47pm, Peng Yu <pengyu.ut at gmail.com> wrote:

> Hi,
> 
> http://www.cplusplus.com/reference/type_traits/is_pod/
> 
> I'm trying to compile the above code. But I get the following error.
> Do I use the correct option for gcc-mp-4.7. Or there is some error
> with my gcc-mp-4.7 installation? Thanks.
> 
> ~/linux/test/cpp/cpp/library/type_traits/is_pod$ gcc-mp-4.7 -std=c++11
> -o main main.cpp
> Undefined symbols for architecture x86_64:
>  "std::basic_ostream<char, std::char_traits<char>
>> ::operator<<(std::basic_ostream<char, std::char_traits<char> >&
> (*)(std::basic_ostream<char, std::char_traits<char> >&))", referenced
> from:
>      _main in ccSTl4KA.o
>  "std::basic_ostream<char, std::char_traits<char>
>> ::operator<<(std::ios_base& (*)(std::ios_base&))", referenced from:
>      _main in ccSTl4KA.o
>  "std::basic_ostream<char, std::char_traits<char>
>> ::operator<<(bool)", referenced from:
>      _main in ccSTl4KA.o
>  "std::ios_base::Init::Init()", referenced from:
>      __static_initialization_and_destruction_0(int, int) in ccSTl4KA.o
>  "std::ios_base::Init::~Init()", referenced from:
>      __static_initialization_and_destruction_0(int, int) in ccSTl4KA.o
>  "std::cout", referenced from:
>      _main in ccSTl4KA.o
>  "std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
> std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&)", referenced from:
>      _main in ccSTl4KA.o
>  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<
> <std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&, char const*)", referenced from:
>      _main in ccSTl4KA.o
> ld: symbol(s) not found for architecture x86_64
> collect2: error: ld returned 1 exit status
> 
> -- 
> Regards,
> Peng
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2030 bytes
Desc: not available
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20131202/4fa97f34/attachment.p7s>


More information about the macports-users mailing list