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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:32:35+00:00 2026-06-01T15:32:35+00:00

I created a DLL project and successfully built it. I then tried to use

  • 0

I created a DLL project and successfully built it. I then tried to use the DLL in another Project, TEST, and I am getting the following error.

Error   1   error LNK2001: unresolved external symbol "public: void __thiscall SnoMessage::setRawMessageName(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?setRawMessageName@SnoMessage@@QAEXV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)

I added the required lib in the linker properties, and I also added the header files in the TEST include directory. So the function is being recognized, but it keeps giving those errors. The DLL is comprised of the following files

SnoMessage.h

#pragma once
#include "StdAfx.h"
class SnoMessage
{
public:
    __declspec(dllexport) SnoMessage(void);
    __declspec(dllexport) ~SnoMessage(void);
    __declspec(dllexport) void setRawMessageName(CString messageName);
    __declspec(dllexport) void setRawMessageType(CString messageType);
    __declspec(dllexport) void setRawMessageAttributes(std::map<CString,CString> attributes);
    __declspec(dllexport) CString getRawMessageName();
    __declspec(dllexport) CString getRawMessageType();
    __declspec(dllexport) std::map<CString,CString> getRawMessageAttributes();

private:
    CString messageName;
    CString messageType;
    std::map<CString,CString> attributes;
};

SnoMessage.cpp

#include "stdafx.h"
#include "SnoMessage.h"


SnoMessage::SnoMessage(void)
{
}


SnoMessage::~SnoMessage(void)
{
}

void SnoMessage::setRawMessageName(CString messageName){
    this->messageName = messageName;
}

void SnoMessage::setRawMessageType(CString messageType){
    this->messageType = messageType;
}

void SnoMessage::setRawMessageAttributes(std::map<CString,CString> attributes){
    this->attributes = attributes;
}

CString SnoMessage::getRawMessageName(){
    return messageName;
}

CString SnoMessage::getRawMessageType(){
    return messageType;
}

std::map<CString,CString> SnoMessage::getRawMessageAttributes(){
    return attributes;
}

And in test I am doing the following:

test.cpp

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "SnoMessage.h"

int _tmain(int argc, _TCHAR* argv[])
{
    SnoMessage *msg = new SnoMessage();
    msg->setRawMessageName("TEST");
    return 0;
}

Let me know if you need more info, thanks.

  • 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-01T15:32:37+00:00Added an answer on June 1, 2026 at 3:32 pm

    In your dll define this in some header you want to use for your export defs…

    MyExports.h

    #ifdef SNOMESSAGE_EXPORTS
    #define SNOMESSAGE_API __declspec(dllexport)
    #else
    #define SNOMESSAGE_API __declspec(dllimport)
    #endif
    

    Now in your dll you just define SNOMESSAGE_EXPORTS, then when your dll is compiled your class and methods will be visible to the exe. But when you include those same headers in the exe the Macro will import them instead of export.

     //In the DLL this is == to export, in the executable this is import.  Problem solved.
    class SNOMESSAGE_API SnoMessage
    {
    public:
    //...
    };
    

    You no longer need to export each member, just the class.

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

Sidebar

Related Questions

I created a dll file built (Project:win32 app, ATL and COM object using Visual
I implemented a C++ dll that compiled successfully. The project contains a header and
I have a C++ DLL project which is created in VS 2010. It is
I'm new to visual c++ and rusty with c++. I created a dll project
Guys; How are you doing today? I have to create a dll project on
I'm using VS 2008 to create a C++ DLL (not managed) project and I
I created a DLL in C++ using Visual Studio 2005. My problem is that
i've created a dll for gamemaker. dll's arrays where really slow so after asking
I wrote a custom class library for NUnit unit tests. It created a dll
Based on http://alexreg.wordpress.com/2009/05/03/strongly-typed-csv-reader-in-c/ , I created a DLL which can read different file types.

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.