definition of dllimport function not allowed

前端 未结 2 1981
面向向阳花
面向向阳花 2021-01-19 05:14

While compiling a C code, I\'m getting the following error:

c:\\users\\kbarman\\documents\\mser\\vlfeat-0.9.13-try\\mser\\stringop.c(71): error C2491: \'vl_s         


        
相关标签:
2条回答
  • 2021-01-19 05:21

    You are saying that the function is external, defined in a Dll. And then you are defining it in your code. This is illegal since is has to be one or the other, but not both external and internal.

    My guess is that you simply need to change dllimport to dllexport. I assume that you are building this code into a library.

    0 讨论(0)
  • 2021-01-19 05:38

    As documentation states, dllimport function are not allowed to have a body right there.

    [...] functions can be declared as dllimports but not defined as dllimports.

    // function definition
    void __declspec(dllimport) funcB() {}   // C2491
    
    // function declaration
    void __declspec(dllimport) funcB();   // OK
    
    0 讨论(0)
提交回复
热议问题