Re: Unexpected compiler error ( error: template argument 1 is invalid ) when using <limits> and using -m32 option on 64-bit system.

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

 



On 24/05/12 20:47, Dan Liew wrote:
> Perhaps it is an issue with my distribution then. Are you using Arch
> Linux on a 64-bit system? I have the output of running $ g++ -v -m32
> limits.cpp here: http://pastebin.com/JRJcVDX2 It is showing some
> header mismatch issues but I do not know if it is related to my issue.
> Any ideas what might be wrong? 

You seem to be using a 64bit-only compiler:
> --disable-multilib

I'd have expected it to reject the -m32 switch in such case, but it's
probably the issue.
For Arch Linux I think you should install the gcc-multilib package.

Probably as consequence of not being, a multilib compiler, it is reading
the bits files from
/usr/include/c++/4.7.0/x86_64-unknown-linux-gnu/bits (which would be 64
bits)
instead of /usr/include/c++/4.7.0/x86_64-unknown-linux-gnu/32/bits
There's only a few differences in my system between both folders, some
#define in c++config.h,
but they seem to make the difference.

The error limits:1405:35: error: template argument 1 is invalid comes
from this excerpt:
> #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
>   /// numeric_limits<__int128> specialization.
>   template<>
>     struct numeric_limits<__int128>
>     {

One of the different defines is precisely _GLIBCXX_USE_INT128 not being
defined in 32bit folder.

So, you don't have multilib compiler properly setup, in -m32 it doesn't
have __int128 type, but
as it's using the wrong config, it is trying nonetheless to use it,
which produces your error.

You should be able to bypass it with -D__STRICT_ANSI__, but then it
might break later at another
point.  You should install the appropiate multilib package.

Regards



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux