public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error with gcc 4.7.1
@ 2012-11-01 16:41 Pranith Kumar
  2012-11-01 16:56 ` Lars Gullik Bjønnes
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pranith Kumar @ 2012-11-01 16:41 UTC (permalink / raw)
  To: gcc-help

Hi,

I am getting the following error when using gcc 4.7.1 to compile:

snprintf(temp, sizeof(temp)/sizeof(temp[0]), "%"PRIi64, value);

error: unable to find string literal operator ‘operator"" PRIi64’

This compiles fine with Intel compiler. Is this a bug? Is there any 
workaround?

Thanks,
Pranith

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error with gcc 4.7.1
  2012-11-01 16:41 Error with gcc 4.7.1 Pranith Kumar
@ 2012-11-01 16:56 ` Lars Gullik Bjønnes
  2012-11-01 17:44 ` rbmj
  2012-11-01 18:26 ` Jonathan Wakely
  2 siblings, 0 replies; 6+ messages in thread
From: Lars Gullik Bjønnes @ 2012-11-01 16:56 UTC (permalink / raw)
  To: gcc-help

Pranith Kumar <pranith@gatech.edu> writes:

| Hi,
>
| I am getting the following error when using gcc 4.7.1 to compile:

in -std=gnu++11 mode right?

| snprintf(temp, sizeof(temp)/sizeof(temp[0]), "%"PRIi64, value);
>
| error: unable to find string literal operator ‘operator"" PRIi64’
>
| This compiles fine with Intel compiler. Is this a bug? Is there any
| workaround?

add a space between "%" and PRIi64 -> '"%" PRIi64'

-- 
	Lgb

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error with gcc 4.7.1
  2012-11-01 16:41 Error with gcc 4.7.1 Pranith Kumar
  2012-11-01 16:56 ` Lars Gullik Bjønnes
@ 2012-11-01 17:44 ` rbmj
  2012-11-01 18:27   ` Jonathan Wakely
  2012-11-01 18:26 ` Jonathan Wakely
  2 siblings, 1 reply; 6+ messages in thread
From: rbmj @ 2012-11-01 17:44 UTC (permalink / raw)
  To: gcc-help

On 11/1/2012 12:41 PM, Pranith Kumar wrote:
> Hi,
>
> I am getting the following error when using gcc 4.7.1 to compile:
>
> snprintf(temp, sizeof(temp)/sizeof(temp[0]), "%"PRIi64, value);

Your error has to do (as far as I can see) with the new user defined 
literals in c++11.  To the compiler, "%"PRIi64 looks like a user-defined 
literal.  I'm assuming that PRIi64 is a #define to some literal string.

>
> error: unable to find string literal operator ‘operator"" PRIi64’
>
> This compiles fine with Intel compiler. Is this a bug? Is there any
> workaround?
>

If you add a space between the two, you should be fine.

--
rbmj

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error with gcc 4.7.1
  2012-11-01 16:41 Error with gcc 4.7.1 Pranith Kumar
  2012-11-01 16:56 ` Lars Gullik Bjønnes
  2012-11-01 17:44 ` rbmj
@ 2012-11-01 18:26 ` Jonathan Wakely
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2012-11-01 18:26 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: gcc-help

On 1 November 2012 16:41, Pranith Kumar wrote:
> Hi,
>
> I am getting the following error when using gcc 4.7.1 to compile:
>
> snprintf(temp, sizeof(temp)/sizeof(temp[0]), "%"PRIi64, value);
>
> error: unable to find string literal operator ‘operator"" PRIi64’
>
> This compiles fine with Intel compiler. Is this a bug? Is there any
> workaround?

It's not a bug.  See the "User-defined literals and whitespace"
section of http://gcc.gnu.org/gcc-4.7/porting_to.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error with gcc 4.7.1
  2012-11-01 17:44 ` rbmj
@ 2012-11-01 18:27   ` Jonathan Wakely
  2012-11-01 18:31     ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2012-11-01 18:27 UTC (permalink / raw)
  To: rbmj; +Cc: gcc-help

On 1 November 2012 17:43, rbmj wrote:
>  I'm assuming that PRIi64 is a #define to some literal string.

Yes, as required by C99 and later standards.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error with gcc 4.7.1
  2012-11-01 18:27   ` Jonathan Wakely
@ 2012-11-01 18:31     ` Jonathan Wakely
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2012-11-01 18:31 UTC (permalink / raw)
  To: rbmj; +Cc: gcc-help

On 1 November 2012 18:27, Jonathan Wakely wrote:
> On 1 November 2012 17:43, rbmj wrote:
>>  I'm assuming that PRIi64 is a #define to some literal string.
>
> Yes, as required by C99 and later standards.

Well, required if int64_t is provided anyway.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-01 18:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 16:41 Error with gcc 4.7.1 Pranith Kumar
2012-11-01 16:56 ` Lars Gullik Bjønnes
2012-11-01 17:44 ` rbmj
2012-11-01 18:27   ` Jonathan Wakely
2012-11-01 18:31     ` Jonathan Wakely
2012-11-01 18:26 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).