Compiling Microsoft CRT 11 (msvcrt110.dll) - What is the correct order of includes?

1k views Asked by At

I am trying to compile the Microsoft CRT 11 by myself (The version that comes along with VS2012).

I'm aware that until VS2008 this action was completely supported by Microsoft:

http://msdn.microsoft.com/en-us/library/k9a8ehy3(v=vs.90).aspx

But since VS2010 you are not supposed to do it anymore, and I'm aware of the risks (mainly - compiling it wrong, and having problems that you can't figure or solve)

I'm using the following directories that come with VS as input code and header files:

 Code:
 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src
 Headers:
 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include
 C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
 C:\Program Files (x86)\Windows Kits\8.0\Include\shared
 C:\Program Files (x86)\Windows Kits\8.0\Include\um
 C:\Program Files (x86)\Windows Kits\8.0\Include\WinRT

(So far the only changes I have made are to remove some MSIL sources from the project)

Most of the code compiles already. But I can't compile the file

 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\assert.c

Because of the error:

 error C3861: '_ReturnAddress': identifier not found

If I add

 #include <intrin.h>

it is solved. But I think it's supposed to be solvable without direct changes to the code.

Of course I'm constantly facing new challenges. But I think the solution to the current one is to fix the include order of the header directories. In which order should the header directories be used?

1

There are 1 answers

0
Jerem On

You can force an include (without changing the source code) in the visual studio project (although I'm not sure if it's a better solution).

To do so, right click on the .c in the solution explorer then go in C/C++ -> Advanced -> Force Include File and add intrin.h (or add /FI"intrin.h" in the command line).