Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Cannot seem to be able to compile with -O2
Cannot seem to be able to compile with -O2 [message #879039] Wed, 30 May 2012 12:16 Go to next message
Palmer Eldritch is currently offline Palmer EldritchFriend
Messages: 40
Registered: February 2011
Member
Please help me this is driving me crazy !
Well what I get in the build output is :

Debug :
**** Build of configuration Debug for project asfaleia_hw3 ****

**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o main.o ..\main.cpp
g++ -o asfaleia_hw3.exe main.o
...

Release :
**** Rebuild of configuration Release for project asfaleia_hw3 ****

**** Internal Builder is used for build ****
g++ -O3 -Wall -c -fmessage-length=0 -o main.o ..\main.cpp
g++ -o asfaleia_hw3.exe main.o
...

But I have specified -O2 as the compiler argument : ht tp: //www.bild.me/bild.php?file=3110466-O2.jpg
debug : ht tp: //www.bild.me/bild.php?file=4209407debug-O2.jpg

Till some point it was working great - I changed some workspace settings but not sure what's wrong

My .cproject :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>

<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
	<storageModule moduleId="org.eclipse.cdt.core.settings">
		<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807">
			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807" moduleId="org.eclipse.cdt.core.settings" name="Debug">
				<externalSettings/>
				<extensions>
					<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
				</extensions>
			</storageModule>
			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.exe.debug">
					<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807." name="/" resourcePath="">
						<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.1469459977" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug">
							<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.1255650963" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/>
							<builder buildPath="${workspace_loc:/asfaleia_hw3/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1637975568" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
							<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.1101398299" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug">
								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1125135213" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
							</tool>
							<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1819688634" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.914486801" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug">
								<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.2055394106" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
								<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.2101351781" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1098279938" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
							</tool>
							<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.832048799" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
								<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.602051395" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" valueType="enumerated"/>
								<option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1092630975" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.278354826" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
							</tool>
							<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1747948330" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/>
							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.858032385" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug">
								<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.4685161" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
								</inputType>
							</tool>
						</toolChain>
					</folderInfo>
				</configuration>
			</storageModule>
			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
		</cconfiguration>
		<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.586289962">
			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.586289962" moduleId="org.eclipse.cdt.core.settings" name="Release">
				<externalSettings/>
				<extensions>
					<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
				</extensions>
			</storageModule>
			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.release.586289962" name="Release" parent="cdt.managedbuild.config.gnu.mingw.exe.release">
					<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.586289962." name="/" resourcePath="">
						<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.release.610511666" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.release">
							<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.release.2059844021" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.release"/>
							<builder buildPath="${workspace_loc:/asfaleia_hw3/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1819028856" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
							<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release.1155961527" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release">
								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.647267910" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
							</tool>
							<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.2008065399" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.282792496" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release">
								<option id="gnu.cpp.compiler.mingw.exe.release.option.optimization.level.775607160" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
								<option id="gnu.cpp.compiler.mingw.exe.release.option.debugging.level.1702343683" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.595440934" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
							</tool>
							<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1940416028" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
								<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.1790292482" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" valueType="enumerated"/>
								<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.652461532" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.40347474" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
							</tool>
							<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.26878997" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release"/>
							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release.157052916" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release">
								<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.728829956" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
								</inputType>
							</tool>
						</toolChain>
					</folderInfo>
				</configuration>
			</storageModule>
			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
		</cconfiguration>
	</storageModule>
	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
		<project id="asfaleia_hw3.cdt.managedbuild.target.gnu.mingw.exe.1142478572" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/>
	</storageModule>
	<storageModule moduleId="refreshScope" versionNumber="1">
		<resource resourceType="PROJECT" workspacePath="/asfaleia_hw3"/>
	</storageModule>
	<storageModule moduleId="scannerConfiguration">
		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807;cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.832048799;cdt.managedbuild.tool.gnu.c.compiler.input.278354826">
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
		</scannerConfigBuildInfo>
		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807;cdt.managedbuild.config.gnu.mingw.exe.debug.1009395807.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.914486801;cdt.managedbuild.tool.gnu.cpp.compiler.input.1098279938">
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
				<buildOutputProvider>
					<openAction enabled="true" filePath=""/>
					<parser enabled="true"/>
				</buildOutputProvider>
				<scannerInfoProvider id="specsFile">
					<runAction arguments="-O2 -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;" command="g++" useDefault="true"/>
					<parser enabled="true"/>
				</scannerInfoProvider>
			</profile>
		</scannerConfigBuildInfo>
		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.586289962;cdt.managedbuild.config.gnu.mingw.exe.release.586289962.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.282792496;cdt.managedbuild.tool.gnu.cpp.compiler.input.595440934">
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
				<buildOutputProvider>
					<openAction enabled="true" filePath=""/>
					<parser enabled="true"/>
				</buildOutputProvider>
				<scannerInfoProvider id="specsFile">
					<runAction arguments="-O2 -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;" command="g++" useDefault="true"/>
					<parser enabled="true"/>
				</scannerInfoProvider>
			</profile>
		</scannerConfigBuildInfo>
		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.586289962;cdt.managedbuild.config.gnu.mingw.exe.release.586289962.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1940416028;cdt.managedbuild.tool.gnu.c.compiler.input.40347474">
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
		</scannerConfigBuildInfo>
	</storageModule>
</cproject>


eclipse-kepler JEE
Win7 x64
Re: Cannot seem to be able to compile with -O2 [message #879401 is a reply to message #879039] Thu, 31 May 2012 06:46 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1968
Registered: July 2009
Senior Member
You changed the command line for the scanner discovery! This is used to get the builtin include paths and symbols from the compiler. You have to tweak the build settings in C/C++ Build->Settings

see http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_build_settings_tool.htm


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Cannot seem to be able to compile with -O2 [message #880929 is a reply to message #879401] Sun, 03 June 2012 11:52 Go to previous messageGo to next message
Palmer Eldritch is currently offline Palmer EldritchFriend
Messages: 40
Registered: February 2011
Member
Thanks - what exactly should I tweak ? I used to just add the -O2 flag in the
Project Properties > C/C++ Build >Discovery Options > Compiler Invocation Arguments
Why does not this work anymore ?


eclipse-kepler JEE
Win7 x64
Re: Cannot seem to be able to compile with -O2 [message #881208 is a reply to message #880929] Mon, 04 June 2012 06:12 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1968
Registered: July 2009
Senior Member
Palmer Eldritch wrote on Sun, 03 June 2012 13:52
Thanks - what exactly should I tweak ? I used to just add the -O2 flag in the
Project Properties > C/C++ Build >Discovery Options > Compiler Invocation Arguments
Why does not this work anymore ?

Please have a look at the help page in the link I provided. You should change Project Properties > C/C++ Build: GCC C++ Compiler->Optimization


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Cannot seem to be able to compile with -O2 [message #881381 is a reply to message #881208] Mon, 04 June 2012 12:47 Go to previous message
Palmer Eldritch is currently offline Palmer EldritchFriend
Messages: 40
Registered: February 2011
Member
Axel Mueller wrote on Mon, 04 June 2012 02:12
Palmer Eldritch wrote on Sun, 03 June 2012 13:52
Thanks - what exactly should I tweak ? I used to just add the -O2 flag in the
Project Properties > C/C++ Build >Discovery Options > Compiler Invocation Arguments
Why does not this work anymore ?

Please have a look at the help page in the link I provided. You should change Project Properties > C/C++ Build: GCC C++ Compiler->Optimization

Thanks - I looked at it already and I guessed I must change this
The strange thing is that before I was able to supply the arg as seen in the image I posted (not able to post URLs yet so you must add an http to it) - section Project Properties > C/C++ Build >Discovery Options > Compiler Invocation Arguments - while suddenly this change would not get through (I had eclipse crash once - cause when the console buffer overflows one cannot do otherwise duh - and I believe this to be the cause (?))
Thanks again Smile


eclipse-kepler JEE
Win7 x64
Previous Topic:Launch Failed. Binary Not Found. But found after refresh
Next Topic:Editor does not recognize CPP syntax after adding c++ nature
Goto Forum:
  


Current Time: Fri Nov 28 07:20:26 GMT 2014

Powered by FUDForum. Page generated in 0.11316 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software