Nicholas Nicholas -4 years ago 137
C++ Question

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
#define PHASESHIFTENGINE_API __declspec(dllexport)
#define PHASESHIFTENGINE_API __declspec(dllimport)

And another Header File of a simple 2D Vector implementation to be exported:

#pragma once

#include "phaseShiftAPI.h"
#include <algorithm>

template<class T>
T m_x, m_y;
T m_elements[1];

PSVec2(const T& m_x, const T& m_y);
PSVec2(const PSVec2& other);
PSVec2(PSVec2&& other);


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>

#include "phaseShiftAPI.h"

After all this why won't a .lib file be created?

Answer Source

In Project Properties -> General, set Configuration Type to Static Library (.lib)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download