0

I'm trying to use some libraries like SDL in a c++ project on Visual Studio with Common Language Runtime (I need one function of System : GetType())

Before using CLR, everything was working. I added the .h and .lib to the project etc...

Now the problem is that external function seems to not have been defined (I get link error)

Apparently, it is because in CLR they must be define with _clrcall but obviously I don't have my hands on the definition of the function... Is there any way I can do this ?

Don't think it will help but here is the test code I made that isn't working :

#using <mscorlib.dll>
#include <iostream>
#include <SDL.h>

int main()
{
    SDL_Init(SDL_INIT_VIDEO);
    return 0;
}

error LNK2028: unresolved token (0A0004C0) "extern "C" int __cdecl SDL_Init(unsigned int)" (?SDL_Init@@$$J0YAHI@Z) referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@$$FYAHXZ)

error LNK2019: unresolved external symbol "extern "C" int __cdecl SDL_Init(unsigned int)" (?SDL_Init@@$$J0YAHI@Z) referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@$$FYAHXZ)

Thanks for any help provided :)

Ali
  • 3,373
  • 5
  • 42
  • 54
e.farman
  • 335
  • 2
  • 12
  • That has nothing to do with the preprocessor or compiler or header files. It has to do with the *linker* stage, where libraries are linked with to create the final executable. And there are apparently some libraries you don't link with. – Some programmer dude Jun 16 '17 at 09:30
  • Yes indeed, I found out that it was not due to CLR but I have the exact same configuration as before ...I'm confused. Thanks anyhow – e.farman Jun 16 '17 at 10:02

0 Answers0