22
#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?

Mask
  • 33,129
  • 48
  • 101
  • 125
  • You are using GCC 3.4.5. It would be wise to update, because that's just too old to be useful... – rubenvb Mar 24 '13 at 09:17

2 Answers2

16

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.

leanid.chaika
  • 2,143
  • 2
  • 27
  • 30
11

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.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • Eclipse is an editor/IDE. What matters here is what compiler you're using *with* Eclipse. – Jerry Coffin Mar 26 '10 at 03:14
  • 1
    @Mask: MinGW doesn't support that header. Period. – Billy ONeal Mar 26 '10 at 04:29
  • @Billy ONeal: MinGW supports the header, in order to use *intrin.h, the corresponding flag must be passed to the compiler (e. g. -msse for xmmintrin.h or -msse2 for emmintrin.h). – susmits Mar 08 '12 at 16:21
  • 1
    @susmits: Not true. It supports `*intrin.h` but not `intrin.h`. – Billy ONeal Mar 08 '12 at 17:23
  • You can try #defining it to use xmmintrin.h. then really test about runtime errors. – Петър Петров Jan 20 '13 at 00:21
  • @Billy wrong. MinGW-w64 has that header. I'm not sure to what extent it is implemented though. See [here](http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-headers/crt/intrin.h?revision=5517&view=markup) – rubenvb Mar 24 '13 at 09:14
  • 1
    @rubenvb: Note that it appears that file was added to the repository 6 months after I posted the comment above. Also, MinGW-w64 and MinGW are completely different projects; even if they were forked from the same codebase to begin with. – Billy ONeal Mar 25 '13 at 17:07
  • @Billy: right on all points except the fork part. MinGW-w64 was written from scratch. And IMHO there is no reason to use MinGW anymore, MinGW-w64 provides a huge superset of what MinGW provides. – rubenvb Mar 25 '13 at 19:53
  • @rubenvb: Erm, no, it was not written from scratch. Both projects are forks of GCC. – Billy ONeal Mar 25 '13 at 20:37
  • @BillyONeal Wrong. Both use vanilla GCC. Both are Public Domain implementation of the Win32 API (headers+libraries). MinGW(-w64) != GCC, although everybody thinks it is. Their primary product is of course GCC+binutils toolchains, and a most developers of both projects spend a lot of time fixing GCC for Windows. – rubenvb Mar 26 '13 at 08:58