LNK2019 problem

前端 未结 4 1765
面向向阳花
面向向阳花 2021-01-06 08:02

I have a LNK2019 problem when trying to use some DLL in my project.

Details:

  1. I have a DLL project called dll1; that compiled just fine (using __d
4条回答
  •  囚心锁ツ
    2021-01-06 08:06

    For regular static class methods the declspec(dllexport) should be sufficient but in some cases (inline friend functions for example) you need to provide declspec(dllexport) for the function.

    e.g.

    #define DLLEXPORT __declspec(dllexport) 
    
    class DLLEXPORT A {
    
    
         A();
    
         int somefunc();
    
         DLLEXPORT friend int operator==(const A &ws1, const A &ws2) 
                { /* some code */ } 
    
    };   
    

提交回复
热议问题