Discussion:
pragma message
(too old to reply)
tb2000
2005-07-29 22:39:03 UTC
Permalink
Just trying to get a handle on porting some libs to CE I woudl like to be
able to have #pragma message print out compiler directives like _MSC_VER or
UNDER_CE or (would be best) be able to dump any of those constants or
settings when invoking the compiler, just to check and debug the compile
environment.
Does anybody have an idea / suggestions?
I tried #pragma message ("and:" _MSC_VER ":")
but I am getting
C:\test\try1\testheader.h(6) : warning C4081: expected ')'; found 'constant'
from the compiler.
Thanks from a newbie!
Benedetto Proietti
2005-08-04 01:40:12 UTC
Permalink
Try this

x.c:
#define T(a) #a
#define S(a) T(a)
#pragma message (S(_MSC_VER))

c:> cl /c x.c
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50802 for MIPS
R-Series
Copyright (C) Microsoft Corporation. All rights reserved.

x.c
1400

The "#" is the stringify operator, it needs to be wrapped when applied to
macros.

Hope it could help,
benedetto


--------------------
Thread-Topic: pragma message
thread-index: AcWUjlHxhO8NzvhrROawwj9UHTrPYA==
X-WBNR-Posting-Host: 84.146.152.233
Subject: pragma message
Date: Fri, 29 Jul 2005 15:39:03 -0700
Lines: 11
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.windowsce.embedded.vc
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.windowsce.embedded.vc:10283
X-Tomcat-NG: microsoft.public.windowsce.embedded.vc
Just trying to get a handle on porting some libs to CE I woudl like to be
able to have #pragma message print out compiler directives like _MSC_VER or
UNDER_CE or (would be best) be able to dump any of those constants or
settings when invoking the compiler, just to check and debug the compile
environment.
Does anybody have an idea / suggestions?
I tried #pragma message ("and:" _MSC_VER ":")
but I am getting
C:\test\try1\testheader.h(6) : warning C4081: expected ')'; found 'constant'
from the compiler.
Thanks from a newbie!
tb2000
2005-08-08 08:48:03 UTC
Permalink
Thanks, I though there must be a way! That was helpful!
Theo
r***@pen_fact.com
2005-08-04 21:03:00 UTC
Permalink
My 23 Feb 04 contribution to a thread called "Howto: place CPU-Type en
CE version in version header of the exe?" in
microsoft.public.windowsce.embedded.vc includes use of a pragma to
spit out info about the build. The line using pragma is way at the
bottom.

You can get the IDE to spit out most of the info. For eVC, it is
Project->Settings->C/C++->Customize->Suppress startup banner...
You want to uncheck the box, so you _don't_ suppress the banner.


On Fri, 29 Jul 2005 15:39:03 -0700, tb2000
Post by tb2000
Just trying to get a handle on porting some libs to CE I woudl like to be
able to have #pragma message print out compiler directives like _MSC_VER or
UNDER_CE or (would be best) be able to dump any of those constants or
settings when invoking the compiler, just to check and debug the compile
environment.
Does anybody have an idea / suggestions?
I tried #pragma message ("and:" _MSC_VER ":")
but I am getting
C:\test\try1\testheader.h(6) : warning C4081: expected ')'; found 'constant'
from the compiler.
Thanks from a newbie!
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
tb2000
2005-08-08 08:49:02 UTC
Permalink
Thanks!
Post by r***@pen_fact.com
My 23 Feb 04 contribution to a thread called "Howto: place CPU-Type en
CE version in version header of the exe?" in
microsoft.public.windowsce.embedded.vc includes use of a pragma to
spit out info about the build. The line using pragma is way at the
bottom.
You can get the IDE to spit out most of the info. For eVC, it is
Project->Settings->C/C++->Customize->Suppress startup banner...
You want to uncheck the box, so you _don't_ suppress the banner.
On Fri, 29 Jul 2005 15:39:03 -0700, tb2000
Post by tb2000
Just trying to get a handle on porting some libs to CE I woudl like to be
able to have #pragma message print out compiler directives like _MSC_VER or
UNDER_CE or (would be best) be able to dump any of those constants or
settings when invoking the compiler, just to check and debug the compile
environment.
Does anybody have an idea / suggestions?
I tried #pragma message ("and:" _MSC_VER ":")
but I am getting
C:\test\try1\testheader.h(6) : warning C4081: expected ')'; found 'constant'
from the compiler.
Thanks from a newbie!
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
Continue reading on narkive:
Loading...