Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9276509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:52:19+00:00 2026-06-18T16:52:19+00:00

My objective is to create a dll and lib file so i’m following this

  • 0

My objective is to create a dll and lib file so i’m following this guide
1) I created a new win32 Console Application project in VS, chose DLL as ‘Application Type’ and Emptied Project
2) I’m trying to create a database in C++. So I have 5 headers with ONLY function declarations.
3) Database.h is my top header, it looks like this:

#ifdef DBDLL_EXPORTS
#define DBDLL_API __declspec(dllexport) 
#else
#define DBDLL_API __declspec(dllimport) 
#endif
#ifndef __Database_H
#define __Database_H


#include "Table.h"

class DBDLL_API Database { ... };
#endif

4) Now with only headers, I tried compiling the project. It compiled but I don’t see any DLLs or Libs anywhere in the project folder. How do I create them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:52:21+00:00Added an answer on June 18, 2026 at 4:52 pm

    This is because headers are not compiled — only CPP files are compiled (which pull in the headers — a source file and all the headers it pulls in is called a “translation unit”, which is the thing actually being compiled (independent of other TUs)).

    So, in effect, the build system thinks you’re building an empty project, and in this case generates nothing at all. Note that even if the headers are pulled in and compiled, unless an exported symbol is actually referenced somewhere, it may be optimized out. In such cases, you will get an (empty) DLL, but no .lib file (which can cause errors down the line if you have dependent projects looking for this .lib before there’s anything in the DLL).

    You’ll need to create some CPP files that implement the functions declared in the headers. If you have everything in the headers and don’t need any CPP files at all, then there’s no point in having a DLL! (Since you could include the headers in any other project without needing any other dependency.)

    Finally, your include guard (#ifndef ...) should encompass the entire header, including the DLL export macros, otherwise you’ll eventually get macro redefinition warnings.

    I would suggest using #pragma once instead of include guards since it’s simpler and recognized by pretty much every compiler. I would also put the DLL macro goop into its own header (e.g. “dllmacros.h”) and include that where it’s needed (this will reduce duplication).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When create the new objective-c class UIViewController file. I want to know which command/
I'm trying to create an objective C classe for my iPad application which can
My objective is to create a customer calculator application for iPhone and I am
Actually my objective is; Create asp.net web service (namespace ws, class Service1) Create dll
Step 1. Create a simple console app in Xcode Step 2. Create simple objective
I'm following Django documentation here in order to achieve a simple objective: Create a
I want to create an Objective-C application which lets you specify a class implementation
I am developing a small web application application. The objective is to create one
In Xcode when you create a new objective c unit test case, it asks
I'm new to objective c and i want to create a class containing certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.