Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cope with "intrin.h: No such file or directory"?

Tags:

#include <intrin.h>

The above will report:

intrin.h: No such file or directory

Which seems to be a MSVC header file,but I'm using eclipse cdt,how can I make it available?Is there some libraries needed?

cdt uses MinGW for compiling,but there is no intrin.h:

D:\Tools\MinGW\lib\gcc\mingw32\3.4.5\include>dir *intrin.h

2006-01-17  21:47            34,528 emmintrin.h
2006-01-17  21:47            22,281 mmintrin.h
2006-01-17  21:47             3,586 pmmintrin.h
2006-01-17  21:47            30,925 xmmintrin.h

Is there anyone can help?

like image 930
Mask Avatar asked Mar 26 '10 01:03

Mask


2 Answers

I have same problem. using eclipse + cdt + mingw32-gcc7.2 + glm (openGL math libraty) I replace #include <intrin.h> with #include <x86intrin.h> add flag to gcc -msse2 and all worked.

like image 95
leanid.chaika Avatar answered Oct 07 '22 05:10

leanid.chaika


This is a header that declares a bunch of "intrinsics" -- functions that are built into the compiler so it can emit inline code for them. If you're using VC++ as the compiler, it should be in the same directory with its other standard headers. If you're using a different compiler, you'll need to change the intrinsics to suit the compiler you are using. gcc, for example, has a lot of similar intrinsic functions, but with slightly different names.

Edit: Given that you're using MinGW (I.e., gcc), you're pretty much stuck with porting the code (or using VC++). If you're dealing with a fairly small amount of code, one way to do that is to comment out the line that includes that header, and try to compile it. The compiler will point out errors where the intrinsic functions were used that gcc doesn't have. You can then look those up (e.g., on MSDN) and try to find something that gcc does provide that does (close enough to) the same thing. Depending on what it uses (and how much) that may be quick and easy, or it may be easier to start over producing new code to do the same things.

The *intrinsic headers you've found will (probably) contain declarations of (at least some of) gcc's counterparts to Microsoft's that you need to replace. You'll probably end up using them in the process of porting the code, so don't forget about them. At the same time, just including those headers instead of Microsoft's almost certainly isn't going to make the code work either.

like image 44
Jerry Coffin Avatar answered Oct 07 '22 04:10

Jerry Coffin