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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:00:30+00:00 2026-05-27T06:00:30+00:00

I am trying to build a very simple C++ unit test project. The setup

  • 0

I am trying to build a very simple C++ unit test project. The setup is just so happened to be exactly the same as what this blog described. I built a static library TestLib.lib and a C++ unit test project called TestProject. Both projects are using platform toolset v100.

The Testlib contains only one class.

BaseClass.h

#pragma once 

class BaseClass
{
public:
    void Method1();
};

BaseClass.cpp

#include "BaseClass.h"
#include <iostream>
#include <list>

using namespace std;

void BaseClass::Method1()
{
    list<int> dummy(0);
    cout << "Hello world";
}

The TestProject has only one test case.

#include "BaseClass.h"
#include <list>
.
.
.
[TestMethod]
void TestMethod1()
{
    BaseClass b;
    b.Method1();
};

It looks like if I have a #include <list> after #include "BaseClass.h" (in the test.cpp) I will have the following link error. If I take out the #include <list>, I have no link error at all.

TestLib.lib(BaseClass.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
MSVCMRT.lib(locale0_implib.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.basic_string<char,std::char_traits<char>,std::allocator<char> >): (0x0200003d).
MSVCMRT.lib(locale0_implib.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >): (0x02000063).
LINK : fatal error LNK1255: link failed because of metadata errors

The link error will be gone if I add one more line to the test program, like this:

#include "BaseClass.h"
#include <list>
.
.
.
[TestMethod]
void TestMethod1()
{
    std::list<int> dummy(0);
    BaseClass b;
    b.Method1();
};

However, now, I have two link warnings. I am not sure whether they are related to the previous link errors.

TestLib.lib(BaseClass.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library

Can anybody explain why? Do I miss something obvious here?

  • 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-05-27T06:00:31+00:00Added an answer on May 27, 2026 at 6:00 am

    Does the error only show up when compiling the Debug configuration? If so, it may be related to your C++ run-time library linkage:

    http://social.msdn.microsoft.com/Forums/eu/vclanguage/thread/e5a78770-4d99-40b7-951f-e4466d2744a8

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

Sidebar

Related Questions

I am just trying to compile and run a very simple test program, but
I am trying to build this very simple (visually speaking) layout using HTML/CSS that
I am trying to build a very simple java project in Eclipse SDK Version:
I'm getting the following error when trying to build my very simple webservice project.
I'm trying to build a very, very simple micro-webapp which I suspect will be
I am trying to build a very simple Contact browser. I have a Collection
I'm trying to build a very simple OpenGL-app under Ubuntu 10.04 (I have a
After working through the Django tutorial I'm now trying to build a very simple
I've been trying to build this small java app. I find it very difficult
**Despite how long this looks, I know it is very simple, I just added

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.