简体   繁体   English

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

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

I am trying to create a small library(game engine) which can be exported as a .dll and then used in another project(game). 我正在尝试创建一个小的库(游戏引擎),可以将其导出为.dll,然后在另一个项目(游戏)中使用。 I have a solution in Visual Studio with two projects one the dll project(game engine) and the main gamewin32 project. 我在Visual Studio中有两个项目的解决方案,其中一个是dll项目(游戏引擎),另一个是主gamewin32项目。

In the the game project I will be using impilicit linking but the problem is the dll project won't generate a .lib file. 在游戏项目中,我将使用默认链接,但问题是dll项目不会生成.lib文件。

In my dll project file I have a header file which contains : 在我的dll项目文件中,我有一个包含以下内容的头文件:

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

And another Header File of a simple 2D Vector implementation to be exported: 另一个要导出的简单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);
};

Along with its .cpp file. 连同其.cpp文件。

I also have a precompiled header cointaining: 我也有一个预编译的header cotaining:

#pragma once

#ifdef _WIN32
    #include "targetver.h"

    #define WIN32_LEAN_AND_MEAN 1
    #include <windows.h>
#endif

#include "phaseShiftAPI.h"

After all this why won't a .lib file be created? 毕竟,为什么不创建.lib文件?

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

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

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