15

In Visual Studio 2005 I went in:

View --> Property Pages --> C/C++ --> Code Generation --> Enable Enhanced Instruction Set

But in Visual Studio 2008?

Thanks in advance

jalf
  • 243,077
  • 51
  • 345
  • 550
Angelo
  • 163
  • 1
  • 1
  • 4

4 Answers4

39

If you're looking for SSE/SSE2: Project > Properties > Configuration Properties > C/C++ > Code Generation > Enable Enhanced Instruction Set, or append /arch:SSE (or /arch:SSE2) in Command Line > Additional Options.

You need to have a native project, and at least one .cpp file added to access this, though.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224
  • Thank you so much! It's not a native project, but I create it with CMake. – Angelo Sep 26 '09 at 10:44
  • 1
    If you regenerate the project files using CMake the settings will not be stored when using this approach. See my answer for details on a permanent fix... – larsmoa Sep 27 '09 at 21:41
  • @CatPlusPlus : Under`Project > Properties > Configuration Properties`I only have`configuration` – user2284570 Mar 14 '15 at 12:59
14

Using CMake you could add the following to CMakeLists.txt:

IF(MSVC)
   ADD_DEFINITIONS(/arch:SSE)
ENDIF(MSVC)

or /arch:SSE2.

larsmoa
  • 12,604
  • 8
  • 62
  • 85
  • 2
    `warning: D9002 : ignoring unknown option '/arch:SSE2'` – mchiasson Jun 08 '15 at 22:16
  • @mchiasson: You will see this message if you try to enable `/arch:SSE2` option while building `x64` code. This basically tells you that you don't need it. `SSE`/`SSE2` is used by [default in `x64` builds](https://stackoverflow.com/q/1067630/670017). – ahmd0 Jul 06 '17 at 10:24
1

It is Project->Properties... (same path as above)

Naveen
  • 74,600
  • 47
  • 176
  • 233
  • Thanks for your reply. I tried but in Project --> Properties I have: - Common Properties + Startup Project + Project Dependencies + Debug Source Files - Configuration Properties + Configuration I don't find any option for the instruction set. – Angelo Sep 26 '09 at 10:26
0

If you are using inline assembler __asm { .... } you don't need to enable it.

But if you enable SSE you have to be careful. It may be that the code is slower than normal FPU code.

StilesCrisis
  • 15,972
  • 4
  • 39
  • 62