0

I tried searching the compiler errors on google, but it didn't even return a search result. So, i'm a little lost here. I just downloaded microsoft detours, built it and got the detours.h, detours.lib, detoured.lib, and detoured.dll files from it. Then, trying to use it in my own project, i get the following errors:

http://friendpaste.com/4egvgn7lOeIVOGkbROCnOC

That is the source code, and at the bottom are the compiler errors. If someone could clarify what is causing these problems, it would be helpful. Thanks! ^_^

Gogeta70
  • 881
  • 1
  • 9
  • 23

2 Answers2

2

They are not compiler errors, they are linker errors. Something is very broken in the way you build this, you are linking the wrong version of the CRT. Even the new and delete operators are undefined, suggesting that you don't link the CRT at all. Very hard to do when you use the MSVC compiler. Document how you build this if that didn't help.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Well, i used nmake (visual cpp) to build it, but i'm using code::blocks as i don't like msvc very much... Also, if i comment out the include "detours.h" and all detours function calls, it builds just fine. – Gogeta70 Nov 08 '10 at 12:16
  • Eh, i meant i used nmake to build the detours code, but i'm using code::blocks and mingw to build my project. And no, all other windows api calls compile and run just fine... – Gogeta70 Nov 08 '10 at 12:52
  • 1
    Mixing and matching cannot work. Build everything with the same tools. – Hans Passant Nov 08 '10 at 12:55
  • I'd say it's even worse than `new` and `delete` missing - you could skip that by compiling as C (Technically, the code is C++ because of the `PVOID&` but that's trivially rewritten). However, the security cookie and SE handling are more fundamental. MSVC uses those in C, too. – MSalters Nov 08 '10 at 13:09
  • @Gogeta70: "all other windows api calls compile fine" - you're mistaken on the "other" part. These missing functions are not part of the Windows API, they're part of MSVC's CRT library. – MSalters Nov 08 '10 at 16:14
-1

Check your compiler and its options. You should use the same as detours was built. Probably you should set /EHa and /GS in compiler code generation settings.

Abyx
  • 12,345
  • 5
  • 44
  • 76