繁体   English   中英

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

[英]Visual Studio DLL Project Won't Create a .lib File When Building

我正在尝试创建一个小的库(游戏引擎),可以将其导出为.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 Vector实现的头文件:

#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文件。

我也有一个预编译的header cotaining:

#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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM