Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > VC++ compile options

Reply
Thread Tools

VC++ compile options

 
 
ashu
Guest
Posts: n/a
 
      02-24-2012
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
 
Reply With Quote
 
 
 
 
Geoff
Guest
Posts: n/a
 
      02-24-2012
On Fri, 24 Feb 2012 08:46:52 -0800 (PST), ashu
<(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
Malcolm McLean
Guest
Posts: n/a
 
      02-25-2012
On Feb 24, 4:46*pm, ashu <(E-Mail Removed)> 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



 
Reply With Quote
 
Geoff
Guest
Posts: n/a
 
      02-26-2012
On Fri, 24 Feb 2012 08:46:52 -0800 (PST), ashu
<(E-Mail Removed)> 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>

 
Reply With Quote
 
Man-wai Chang
Guest
Posts: n/a
 
      03-04-2012
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc compiler options for K&R C code Options Utkado C Programming 2 12-18-2008 01:50 PM
OptionParser - no short options or incomplete options Bryan Richardson Ruby 6 02-25-2008 03:22 AM
Performance issue in multi-level Oracle Object/thin JDBC Options Options jacksu Java 0 10-09-2007 08:21 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
good compile options for g++ options to enforce good coding Cliff Martin C++ 1 01-31-2007 02:03 AM



Advertisments