main.obj : error LNK2019 or LNK2001: unresolved external symbol

created at 07-12-2021 views: 2


When writing C++, the initialization function of the class was defined as inline, which resulted in the above link error. At the beginning, I checked the information on the Internet and did not find the problem. Then I compared and analyzed the differences between the two projects based on another project I wrote before, and found that in the project that caused the error, I defined the initialization function as inline.

We know that the inline keyword is to define a function as an inline function, so that some corresponding optimizations can be made when the compiler compiles it, but the inline keyword is used before the initialization function, I guess it is because the initialization function does not have a return type declaration , So when the inline keyword is added, it will cause the compiler to confuse and cause a link error.

created at:07-12-2021
edited at: 07-12-2021: