I have prepared a very simple static link library project(projectlib.lib),only include lib.h and lib.cpp,i want to export a class named c_lib1,there are 2 ways I tried:
(1) Declare class c_lib1 in lib.h and define c_lib1 in lib.cpp.
(2) Define class c_lib1 in lib.h directly:
class c_lib1
{
public:
int m_a, m_b;
int m_add(int a, int b)
{
return a + b;
};
};
Then generate projectlib.lib. Next in an application project (.exe), I use this static library projectlib.lib,in the application project, use the above (1) method, can not identify class c_lib1, but the use of (2) method can compile through, this is why?
What I have tried:
I have tried both these two ways