Discussion:
[edk2] Buidl Error C2496 from AutoGen.c
galla rao
2013-07-10 12:48:50 UTC
Permalink
Hello All,

I am trying to build a optionrom with UDK2010.SR1.UP1 libraries
with /TP as compiler switch

I see error C2496 from AutoGen.c, though i never use these PCD's
when i don't use /TP flag, this error is not seen

c:\udk2010.up1\Build\MdeModule\RELEASE_VS2010\X64\MdeModulePkg\Bus\Pci\Sasdriver\SasDriver\DEBUG\AutoGen.c(65)
: error C2496: '_gPcd_FixedAtBuild_PcdMaximumLinkedListLength' :
'selectany' can only be applied to data items with external linkage
c:\udk2010.up1\Build\MdeModule\RELEASE_VS2010\X64\MdeModulePkg\Bus\Pci\Sasdriver\SasDriver\DEBUG\AutoGen.c(72)
: error C2496: '_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength' :
'selectany' can only be applied to data items with external linkage
c:\udk2010.up1\Build\MdeModule\RELEASE_VS2010\X64\MdeModulePkg\Bus\Pci\Sasdriver\SasDriver\DEBUG\AutoGen.c(79)
: error C2496: '_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength' :
'selectany' can only be applied to data items with external linkage
I am using /TP(for convenience of declaring varaibles) and also some extern
"C" code

Please help me know how to overcome this error


Thanks
Ranga
Tian, Feng
2013-07-11 02:25:51 UTC
Permalink
galla rao
2013-07-11 05:02:38 UTC
Permalink
Thanks Feng

There is some piece of code where variables are declared as
and when needed, i was porting this to UDK compatible

The earlier code was on EDK which used /TP option.
so the same i am trying to continue on UDK as well

Is there a way to overcome this behaviour with /TP option
Alternate solution is to remove /TP and declare the variables at the
beginning of the function (or) open a block to declare variables and run
the code, it does work



On Thu, Jul 11, 2013 at 7:55 AM, Tian, Feng <***@intel.com> wrote:
Andrew Fish
2013-07-11 05:12:45 UTC
Permalink
Post by galla rao
Thanks Feng
There is some piece of code where variables are declared as
and when needed, i was porting this to UDK compatible
This is a C99 thing (and C++). You might see if VC++ 20xx has support for this C99 feature via a flag?Turning on C++ mode for this is kind of overkill....

GCC defaults to C90, but with a subset of C99 extensions, including the one you mentioned.

Thanks,

Andrew Fish
Post by galla rao
The earlier code was on EDK which used /TP option.
so the same i am trying to continue on UDK as well
Is there a way to overcome this behaviour with /TP option
Alternate solution is to remove /TP and declare the variables at the beginning of the function (or) open a block to declare variables and run the code, it does work
galla rao [mailto:]
1970-01-01 00:00:00 UTC
Permalink
/TC and /TP are "global" variants of /Tc and /Tp. They specify to the compiler to treat all files named on the command line as C source files (/TC) or C++ source files (/TP), without regard to location on the command line in relation to the option.

From: galla rao [mailto:***@gmail.com]
Sent: Wednesday, July 10, 2013 20:49
To: edk2-***@lists.sourceforge.net
Subject: [edk2] Buidl Error C2496 from AutoGen.c

Hello All,

I am trying to build a optionrom with UDK2010.SR1.UP1 libraries
with /TP as compiler switch

I see error C2496 from AutoGen.c, though i never use these PCD's
when i don't use /TP flag, this error is not seen

c:\udk2010.up1\Build\MdeModule\RELEASE_VS2010\X64\MdeModulePkg\Bus\Pci\Sasdriver\SasDriver\DEBUG\AutoGen.c(65) : error C2496: '_gPcd_FixedAtBuild_PcdMaximumLinkedListLength' : 'selectany' can only be applied to data items with external linkage
c:\udk2010.up1\Build\MdeModule\RELEASE_VS2010\X64\MdeModulePkg\Bus\Pci\Sasdriver\SasDriver\DEBUG\AutoGen.c(72) : error C2496: '_gPcd_FixedAtBuild_PcdMaximumAsciiStringLength' : 'selectany' can only be applied to data items with external linkage
c:\udk2010.up1\Build\MdeModule\RELEASE_VS2010\X64\MdeModulePkg\Bus\Pci\Sasdriver\SasDriver\DEBUG\AutoGen.c(79) : error C2496: '_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength' : 'selectany' can only be applied to data items with external linkage
I am using /TP(for convenience of declaring varaibles) and also some extern "C" code

Please help me know how to overcome this error


Thanks
Ranga

--_000_7F1BAD85ADEA444D97065A60D2E97EE5019D5B17SHSMSX101ccrcor_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Why are you using /TP compiler option?
Loading...