user1393214
user1393214

Reputation:

Why there is no .dll file after building the source?

I'm gonna build a dll form below source code:

HelloDLL.h

#pragma once

#ifdef DLLDIR_EX
#define DLLDIR_EX __declspec(dllexport)
#else
    #define DLLDIR_EX __declspec(dllimport)
#endif 

class DLLDIR_EX HelloDLL
{
public:
    HelloDLL();
    ~HelloDLL();

    void hello();
    static void helloStatic();
};

And the implementation is just like this:

HelloDLL.cpp

#include "stdafx.h"
#include "HelloDLL.h"
#include <iostream>

using namespace std;


HelloDLL::HelloDLL()
{
}

void HelloDLL::hello()
{
    cout << "Hello world of DLL" << endl;
}

void HelloDLL::helloStatic()
{
    cout << "Hello static world of DLL" << endl;
}

HelloDLL::~HelloDLL()
{
}

After building the project (Ctrl + Shift + B), There is a couple of usual generated files into the Debug folder of the project with below types:

But there is no .dll file... Can anybody tell me what's wrong with this case?

Upvotes: 0

Views: 948

Answers (1)

Mario
Mario

Reputation: 36537

Open your Project Properties, go to Configuration Properties, General and look for the entry Configuration Type. Make sure it's set to the proper output type. By default it will be set to Application (.exe). What you're looking for is Dynamic Library (.dll).

Screenshot from MSVC 2013

Upvotes: 3

Related Questions