0

So I was trying to compile some code (Bullet Physics demos to be specific), and an error came up that said SSE and SSE2 were not enabled. I checked the compiler flags in Code::Blocks, and SSE/SSE2 were not on there. I tried to put the flags in "other options" instead (-msse, -msse2) and that did not work.

Then I saw a post here on stackoverflow that said to try "-march=native", which I did. That did not work either.

I am using G++ (MinGW) to compile, and I am on Windows 7 x64.

If it means anything, the project is using a custom makefile.

BananasGoMoo
  • 68
  • 2
  • 10
  • 2
    explain "that did not work" - `-msse2` should definitely work. I'm not familiar with `Code::Blocks` (I did try that IDE several years ago, but didn't use it very much - I'm an "emacs + command line" type of guy), but if "custom makefile" means that you have a makefile that isn't generated by `Code::Blocks`, then that would explain why you get no effect from setting things in the settings - you need to add `-msse2` to the makefile itself. – Mats Petersson Mar 01 '13 at 12:07

1 Answers1

1

To make this work, you need to have march set to something that supports SSE2 (say, Pentium4 or Core2, in your case "native" might also do since you're running on x86_64, but I've never used "native") and enable SSE2 via -msse2.

But: Since you use a custom makefile, you must do this in your makefile or you must use environment variables (forget environment vars, I just looked, and it seems you can control pretty much everything via these, except target/optimization options).

Code::Blocks sets compiler options when you compile from a project file, but not when using a custom makefile. With a custom makefile, it is assumed that you know what you're doing and that the makefile "works correctly".
Worded differently, you can set any options you like, they won't have any effect as long as you use a cutom makefile.

Damon
  • 67,688
  • 20
  • 135
  • 185
  • okay, thanks. that helped me find it. apparently these people were using like a string of makefiles (dunno why, really weird), and one had a file called flags.make, which had all the flags for the project. – BananasGoMoo Mar 01 '13 at 13:22