Intel C++ compiler optimization flag

Started by
2 comments, last by lride 11 years, 6 months ago
I need to compile a source with full optimization; however, I get the following error

[font=tahoma,geneva,sans-serif]Command line error D8016: '/ZI' and '/Ox' command-line options are incompatible[/font]

[font=tahoma,geneva,sans-serif]the source:[/font]


[source lang="cpp"]

#include <SFML/System.hpp>


#include <algorithm>
#include <iostream>

void func1()
{
// generate data
const unsigned arraySize = 32768;
int data[arraySize];

for (unsigned c = 0; c < arraySize; ++c)
data[c] = std::rand() % 256;



//std::sort(data, data + arraySize);


// test

long long sum = 0;
sf::Clock clock;
for (unsigned i = 0; i < 50000; ++i) //just to see the difference
{
// primary loop
for (unsigned c = 0; c < arraySize; ++c)
{
//int t = (data[c] - 128) >> 31;
//sum += ~t & data[c];

if (data[c] >= 128)
sum += data[c];

}
}

float elapsedTime=clock.getElapsedTime().asSeconds();

std::cout << elapsedTime << std::endl;
std::cout << "sum = " << sum << std::endl;
std::cin.get();
}


int main()
{
func1();
}[/source]
An invisible text.
Advertisement
Nothing to do with the source, you're trying to combine compiler optimization flag Ox with debug flag ZI which is invalid. Go into your project options and uncheck the debug flag.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

There are three options. I tried all of them and still get errors

1)C7 compatible(/Z7) 1>cl : Command line error D8016: '/Ox' and '/RTC1' command-line options are incompatible
2)Program Database(/Zi) 1>cl : Command line error D8016: '/Ox' and '/RTC1' command-line options are incompatible
3)Program Database for Edit and Continue(/ZI) 1>cl : Command line error D8016: '/ZI' and '/Ox' command-line options are incompatible
An invisible text.
Never mind, I fixed it.
Thanks for the reply
An invisible text.

This topic is closed to new replies.

Advertisement