简体   繁体   中英

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). I have a solution in Visual Studio with two projects one the dll project(game engine) and the main gamewin32 project.

In the the game project I will be using impilicit linking but the problem is the dll project won't generate a .lib file.

In my dll project file I have a header file which contains :

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

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

I also have a precompiled header cointaining:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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