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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:01:15+00:00 2026-06-11T11:01:15+00:00

My project has two cpp files and one header file. One cpp file contains

  • 0

My project has two cpp files and one header file. One cpp file contains the implementation of a single class and its declaration is in the header file. The other cpp file is which contains the int main function.

One of the constructors of the class includes a TCHAR parameter and it is cited as the unresolved function in LNK2019 linker error.

I’m using visual studio 2010 and I have set the Character set option in the project properties to Not Set so that I can choose between char and wchar_t using UNICODE and _UNICODE macros.

Currently I have defined these in the beginning of my main cpp file and the header files are included after those two. However, if I define these macros in the beginning of header file, the project compiles perfectly.

Is there anyway to solve this issue ? Or do I have to hard code the class to use either char or wchar_t ?

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-11T11:01:16+00:00Added an answer on June 11, 2026 at 11:01 am

    You are getting the linker error because you are defining the UNICODE/_UNICODE macros inside of main.cpp but not in your class’s implementation .cpp. As such, when main.cpp includes your class’s header file, it sees TCHAR as wchar_t, but when your implementation .cpp includes your header file, it sees TCHAR as char instead. You have a mismatch that causes the linker error because main.cpp calls a wchar_t constructor that you have not actually implemented.

    You are supposed to look for the presence of the UNICODE/_UNICODE macros, not actually define them manually. Set the “Character Set” option to MBCS or Unicode so the IDE/compiler can manage the macros globally for the entire project as a whole for you. I don’t know what setting it to “Not Set” actually does, but it is not what you actually need in this situation.

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

Sidebar

Related Questions

Background I have a project named PersonLibrary which has two files. Person.h Person.cpp This
I'm stumped! In PHP in Netbeans (6.8), a project has two files, file1.php and
We have a project that has two one to many relationships. We encounter a
So I have one main file, and two classes: A display Class, and a
Our project has two application contexts: application-context.xml application-context-test.xml Currently each file has duplicate bean
I have a Django project which has two apps (one created as debug test).
I have an iOS project that has two targets. The first one is intended
I am working in a project that has two main parts: a class library
I'm working on a project that has two modules: a web and an application
I have a clojure/ring project that has two distinct app/handlers running on different ports

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.