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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:13:50+00:00 2026-06-05T15:13:50+00:00

I am using Visual Studio 10 set to use the v90 platform toolset. I

  • 0

I am using Visual Studio 10 set to use the v90 platform toolset. I have three applications that use several of the same classes. So, rather than have three copies of each of those classes, I am trying to move them out into a common static lib. One of them is giving me link problems. The others seem to link fine. Here’s the problem class:

HEADER

#ifndef LIMIT_SINGLE_INSTANCE_INCLUDED
#define LIMIT_SINGLE_INSTANCE_INCLUDED

#include <windows.h> 

class CLimitSingleInstance
{
protected:
  DWORD  m_dwLastError;
  HANDLE m_hMutex;

public:
  CLimitSingleInstance(TCHAR *strMutexName);
  ~CLimitSingleInstance();
  BOOL IsAnotherInstanceRunning();
};
#endif

BODY

#include "LimitSingleInstance.h"

CLimitSingleInstance::CLimitSingleInstance(TCHAR *strMutexName)
{
  //Make sure that you use a name that is unique for this application otherwise
  //two apps may think they are the same if they are using same name for
  //3rd parm to CreateMutex
  m_hMutex = CreateMutex(NULL, FALSE, strMutexName); //do early
  m_dwLastError = GetLastError(); //save for use later
}

CLimitSingleInstance::~CLimitSingleInstance() 
{
  if (m_hMutex)  //Do not forget to close handles.
  {
     CloseHandle(m_hMutex); //Do as late as possible.
     m_hMutex = NULL; //Good habit to be in.
  }
}

BOOL CLimitSingleInstance::IsAnotherInstanceRunning() 
{
  return (ERROR_ALREADY_EXISTS == m_dwLastError);
}

When this class is directly part of one of my main application solutions, there is no problem. I have now moved it into my static lib solution, and that solution builds fine. However, I find that I can no longer link my main application solution against my new static lib. Here is the result of attempting to build both debug and release versions of my main application:

—— Rebuild All started: Project: WCCJ, Configuration: ReleaseTENA Win32 —— CAssetEntity.cpp main.cpp ReadWCCJParameters.cpp
WCCJ.cpp WCCJParameters.cpp Generating Code…
DCTUtilsRel.lib(MessageWrapper.obj) : MSIL .netmodule or module
compiled with /GL found; restarting link with /LTCG; add /LTCG to the
link command line to improve linker performance
Creating library ….\bin\WCCJ-TENA.lib and object ….\bin\WCCJ-TENA.exp main.obj : error LNK2001: unresolved external
symbol “public: __thiscall
CLimitSingleInstance::CLimitSingleInstance(char *)”
(??0CLimitSingleInstance@@QAE@PAD@Z) ….\bin\WCCJ-TENA.exe : fatal
error LNK1120: 1 unresolved externals
—— Rebuild All started: Project: WCCJ, Configuration: DebugTENA Win32 —— CAssetEntity.cpp main.cpp ReadWCCJParameters.cpp
WCCJ.cpp WCCJParameters.cpp Generating Code… CAssetEntity.obj :
warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/INCREMENTAL:NO’
specification
Creating library ….\bin\WCCJ-TENA-d.lib and object ….\bin\WCCJ-TENA-d.exp main.obj : error LNK2019: unresolved
external symbol “public: __thiscall
CLimitSingleInstance::CLimitSingleInstance(char *)”
(??0CLimitSingleInstance@@QAE@PAD@Z) referenced in function “void
_cdecl `dynamic initializer for ‘gSingleInstanceObj”(void)” (??_EgSingleInstanceObj@@YAXXZ) ….\bin\WCCJ-TENA-d.exe : fatal
error LNK1120: 1 unresolved externals
========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ==========

When I open the .lib in a binary editor and search for the mangled name the linker wants (??0CLimitSingleInstance@@QAE@PAD@Z), I find that it is indeed not found. The closest matches I can find are:

??0CLimitSingleInstance@@QAE@PA_W@Z

??1CLimitSingleInstance@@QAE@XZ

@CLimitSingleInstance@@QAEHXZ

Is anybody able to tell me why this is happening and how to fix it? Thanks in advance.

Dave

  • 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-05T15:13:51+00:00Added an answer on June 5, 2026 at 3:13 pm

    The closest matches I can find are: ??0CLimitSingleInstance@@QAE@PA_W@Z

    Use the undname.exe utility from the VS command line on that symbol:

    C:\>undname ??0CLimitSingleInstance@@QAE@PA_W@Z
    Microsoft (R) C++ Name Undecorator
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Undecoration of :- "??0CLimitSingleInstance@@QAE@PA_W@Z"
    is :- "public: __thiscall CLimitSingleInstance::CLimitSingleInstance(wchar_t *)"
    

    Note the argument type, wchar_t*, not char*. Your lib project has UNICODE #defined, your exe project does not. The relevant setting is General + Character Set.

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

Sidebar

Related Questions

Using Visual Studio 2005, I wrote a simple DLL in C that uses the
(Using Visual Studio 2005 / .NET 2.0) I have a DataSet which is being
Using Visual Studio 2008, c#, .net 2.0. I have a Windows Forms client application
I am wondering if I can use VB.NET(I am using visual studio 2010 express)
I am using Visual Studio 2008 and all the components that come with it
We're using Visual Studio Database Professional and it makes heavy use of SQLCMD variables
My scenario I'm using Visual Studio 2010 with Entity Framework 4.1 I have a
I am developing an Windows pplication(using Visual Studio 2008,Sql server 2005). I have to
I have a Visual Studio C++ based program that uses pre-compiled headers ( stdafx.h
I have been using Visual Studio 2005 under Windows XP Pro 64-bit for C

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.