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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:25:43+00:00 2026-05-12T07:25:43+00:00

I’m using Visual C++ 2008 SP1. I have an app that is compiled in

  • 0

I’m using Visual C++ 2008 SP1. I have an app that is compiled in debug mode, but links against a library in release mode.

I’m getting a crash at the start-up of the application. To make the problem smaller, I created a simple solution with 2 projects:

  • lib_release (generates a .lib, in release mode)
  • exec_using_lib_release (genereates a .exe, in debug mode)

The ‘lib_release’ project is simple enough to have a simple class:

//Foo.h
#include <vector>
class Foo {
  std::vector<int> v;
  public:
  void doSomething();
};
//Foo.cpp
#include "Foo.h"
void Foo::doSomething() {}

The ‘exec_using_lib_release’ project is simple like this:

//main.cpp
#include "Foo.h"
int main() {
   Foo foo;
   foo.doSomething();
   return 0;
}

And it crashes, it’s the same problem reported by How do you build a debug .exe (MSVCRTD.lib) against a release built lib (MSVCRT.lib)?, but his answer didn’t work for me.

I get the same linker warnings, I tried the same steps, but none worked. Is there something I’m missing?

EDIT:

On the lib_release (that creates a library in release mode), I’m using Multi Threaded (/MT), and at the exec_using_lib_release, I’m using Multi Threaded Debug (/MTd). I think this is the expected way of doing it, since I want the .lib to be created without debug info. I read the document at MSDN Runtime library and those are the settings of linking against the CRT in a static way.

I don’t have ‘Common Language Runtime Support’ either.

  • 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-12T07:25:43+00:00Added an answer on May 12, 2026 at 7:25 am

    You don’t have to use the same runtimes for release and debug modules (but it helps), as long as you follow very specific rules: never mix and ,match accessing the memory allocated using each runtime.

    To put this more simply, if you have a routine in a dll that allocates some memory and returns it to the caller, the caller must never free it – you must create a function in the original dll that frees the memory. That way you’re safe from runtime mismatches.

    If you consider that the Windows dlls are built release only (unless you have the debug version of Windows), yet you use them from your debug applications, you’ll see how this matters.

    Your problem now is that you’re using a static library, there is no dll boundary anymore, and the calls in the lib are compiled using the static version of the C runtime. If your exe uses the dynamic dll version of the runtime, you’ll find that the linker is using that one instead of the one your static lib used… and you’ll get crashes.

    So, you could rebuild your lib as a dll; or you could make sure they both use the same CRT library; or you could make sure they both use the same type of CRT – ie the dll version or the static version, whilst keeping debug/release differences.

    At least, I think this is your problem – what are the ‘code generation, runtime library’ settings?

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

Sidebar

Ask A Question

Stats

  • Questions 169k
  • Answers 169k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer NoneType is the type of the None object. So, in… May 12, 2026 at 1:55 pm
  • Editorial Team
    Editorial Team added an answer You probably want to use the STR_TO_DATE() function. SELECT STR_TO_DATE(textdate,… May 12, 2026 at 1:55 pm
  • Editorial Team
    Editorial Team added an answer The best equivalent is probably .NET Reflector. It doesn't plug… May 12, 2026 at 1:55 pm

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.