Visual Studio DLL 项目在生成时不会创建 .lib 文件



我试图创建一个小库(游戏引擎),可以导出为。dll,然后在另一个项目(游戏)中使用。我有一个解决方案在Visual Studio与两个项目一个dll项目(游戏引擎)和主要的gamewin32项目。

在游戏项目中,我将使用隐式链接,但问题是dll项目不会生成。lib文件。

在我的dll项目文件中,我有一个头文件,其中包含:

#pragma once
    #ifdef _WIN32
        #ifdef PHASESHIFTENGINE_EXPORTS
            #define PHASESHIFTENGINE_API __declspec(dllexport)
        #else
            #define PHASESHIFTENGINE_API __declspec(dllimport)
    #endif
#endif

和另一个要导出的简单2D矢量实现的头文件:

#pragma once
#include "phaseShiftAPI.h"
#include <algorithm>
template<class T>
class PHASESHIFTENGINE_API PSVec2
{
public:
    union
    {
        T m_x, m_y;
        T m_elements[1];
    };
public:
    PSVec2();
    PSVec2(const T& m_x, const T& m_y);
    PSVec2(const PSVec2& other);
    PSVec2(PSVec2&& other);
   ~PSVec2();
   PSVec2& operator=(const PSVec2& other);
   PSVec2& operator=(PSVec2&& other);
   PSVec2& operator+(const PSVec2& right);
   PSVec2& operator+(const T& right);
   PSVec2& operator++();
   PSVec2& operator-(const PSVec2& right);
   PSVec2& operator-(const T& right);
   PSVec2& operator--();
   PSVec2& operator*(const PSVec2& right);
   PSVec2& operator*(const T& right);
   PSVec2& operator/(const PSVec2& right);
   PSVec2& operator/(const T& right);
};

与其。cpp文件一起。

我也有一个预编译头包含:

#pragma once
#ifdef _WIN32
    #include "targetver.h"
    #define WIN32_LEAN_AND_MEAN 1
    #include <windows.h>
#endif
#include "phaseShiftAPI.h"

在所有这些之后,为什么不创建。lib文件?

在"Project Properties -> General"中,设置"Configuration Type"为"Static Library (.lib)"

最新更新