[英]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.