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 8259567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:53:43+00:00 2026-06-08T02:53:43+00:00

I am starting some work using a third party library and when building it

  • 0

I am starting some work using a third party library and when building it in Visual Studio 2010, I noticed I was receiving this linker warning many times (LNK4221). I looked at the sources used in creating the object files that were being linked and found that all of the implementation for these is located in the header files. Interestingly, I also noticed the project included corresponding .cpp files containing only a #include for the header with the implementation.

I am curious – what is the point of this and why would I want to use this technique? If the .cpp files aren’t adding any value to the project, why shouldn’t I just remove them to get rid of the linker warnings?

I tried searching for similar questions, but didn’t find anything of interest. If you know of any, please link 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-08T02:53:44+00:00Added an answer on June 8, 2026 at 2:53 am

    I’m using this to make sure, that the header is at least in one file included at the first position. By doing so, I make sure that the header is compilable on it’s own.

    To convence the linker to not issue a warning, one could use an external variable with a very large variable:

    int variable_with_a_name_that_includes_the_file_name_somehow = 42;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Visual Studio package that does some of its work by starting
I'm starting work on some simulations using MPI and want to do the programming
I'm using ode45() in matlab for some work in dynamics, using this procedure to
I'm new to this android. i'm using a service to do some background work.
I'm starting some work on a rather large JS project and want to make
I do some android work on my desktop and I am starting to do
We are starting a rather complex new project at work, and need some sort
I'm soon going to be starting some iPhone Development (3.0) building a simple app
I'm starting out with some XML that looks like this (simplified): <?xml version=1.0 encoding=UTF-8?>
I'm creating some basic work assistance utilities using Ruby. I've hit a problem that

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.