Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   VC++ compile options (http://www.velocityreviews.com/forums/t868697-vc-compile-options.html)

ashu 02-24-2012 04:46 PM

VC++ compile options
 
Hi all,
My question is about the syntax of the VC++project file. I have a set
of files which make up the build and I wanted to apply O2 level
optimization only on one file.
Below is a snippet of the .vcxproj file.
************************************************** **************
<ItemGroup>
<ClCompile Include="..\src\b_wrapper.c" />
<ClCompile Include="..\src\assh.c" />
<ClCompile Include="..\src\user_line.c" >
<Optimization>/O2</Optimization>
</ClCompile>
</ItemGroup>
************************************************** ****************
Is the syntax is correct and in that case, would it lead to O2 level
optimization only on user_line.c file ?

regards
ashu

Geoff 02-24-2012 07:46 PM

Re: VC++ compile options
 
On Fri, 24 Feb 2012 08:46:52 -0800 (PST), ashu
<ashutosh.ghildiyal@gmail.com> wrote:

>Hi all,
>My question is about the syntax of the VC++project file. I have a set
>of files which make up the build and I wanted to apply O2 level
>optimization only on one file.
>Below is a snippet of the .vcxproj file.
>************************************************* ***************
> <ItemGroup>
> <ClCompile Include="..\src\b_wrapper.c" />
> <ClCompile Include="..\src\assh.c" />
> <ClCompile Include="..\src\user_line.c" >
> <Optimization>/O2</Optimization>
> </ClCompile>
> </ItemGroup>
>************************************************* *****************
>Is the syntax is correct and in that case, would it lead to O2 level
>optimization only on user_line.c file ?
>
>regards
>ashu


This is off-topic for this group.

However, why are you poking at the project file manually? VC++ IDE
allows you to set per-file optimization settings. Use the Project
Explorer and right-click the source file, then edit properties for
that file.

NOTE: VC++ turns off optimizations in Debug build and sets -O2 on
Release builds across the entire project by default.

Malcolm McLean 02-25-2012 02:37 PM

Re: VC++ compile options
 
On Feb 24, 4:46*pm, ashu <ashutosh.ghildi...@gmail.com> wrote:
>
> Is the syntax is correct and in that case, would it lead to O2 level
> optimization only on user_line.c file ?
>

Unlikely. It's not well-formed xml as the structure would suggest what
you suppose, but most compilers will compile several C source files on
one invocation, keeping the same settings. However the only real way
to find out is to ask VC++ technical support, and even they will
probably have to root around for the answer. Or you could set up a
test file if the optimiser defines a symbol to the preprocessor.
--
Basic Algorithms - a second book of C. Read it after you've finished
your primer.
http://www.malcolmmclean.site11.com/www




Geoff 02-26-2012 01:17 AM

Re: VC++ compile options
 
On Fri, 24 Feb 2012 08:46:52 -0800 (PST), ashu
<ashutosh.ghildiyal@gmail.com> wrote:

>Hi all,
>My question is about the syntax of the VC++project file. I have a set
>of files which make up the build and I wanted to apply O2 level
>optimization only on one file.
>Below is a snippet of the .vcxproj file.
>************************************************* ***************
> <ItemGroup>
> <ClCompile Include="..\src\b_wrapper.c" />
> <ClCompile Include="..\src\assh.c" />
> <ClCompile Include="..\src\user_line.c" >
> <Optimization>/O2</Optimization>
> </ClCompile>
> </ItemGroup>
>************************************************* *****************
>Is the syntax is correct and in that case, would it lead to O2 level
>optimization only on user_line.c file ?
>
>regards
>ashu


I selected a single source file within a project with Project Explorer
and it did this:

<ClCompile Include="g_misc.c">
<PreprocessorDefinitions
Condition="'$(Configuration)|$(Platform)'=='Debug| Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions
Condition="'$(Configuration)|$(Platform)'=='Releas e|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization
Condition="'$(Configuration)|$(Platform)'=='Debug| Win32'">MaxSpeed</Optimization>
</ClCompile>


Man-wai Chang 03-04-2012 07:44 AM

Re: VC++ compile options
 
> My question is about the syntax of the VC++project file. I have a set
> of files which make up the build and I wanted to apply O2 level
> optimization only on one file.
> Below is a snippet of the .vcxproj file.


Shouldn't you use a make file if you wanna do things command-line?

--
@~@ You have the right to remain silence.
/ v \ Simplicity is Beauty! May the Force and farces be with you!
/( _ )\ (Fedora 15 i686) Linux 3.2.6
^ ^ 15:41:01 up 9 days 2:38 0 users load average: 0.00 0.01 0.05
不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):
http://www.swd.gov.hk/tc/index/site_...sub_addressesa


All times are GMT. The time now is 01:10 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.