Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
| Search | Today's Posts | Mark Forums Read
Visual C++ 2005 For discussion of Visual C++ 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 14th, 2006, 11:47 AM
Registered User
Join Date: Apr 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unresolved External Symbol - LNK2019

I have just started programming with C using Visual C++. At the moment I am learning how to handle classes. I am using a C++ book, where I am instructed to create applications that use classes like this:

#pragma once

class Person
    char name[30];
    int age;

#include "stdafx.h"
using namespace std;

    name = "Name";
    age = 15;

#pragma once

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include "Person.h"


#include "stdafx.h"
using namespace std;

void main()
    Person person;

This is not working. I get an unresolved external symbol LNK2019 error:
Person.obj : error LNK2019: unresolved external symbol "public: __thiscall Person::Person(void)" (??0Person@@QAE@XZ) referenced in function _main

I have made the example here as simple as possible. I have searched MSDN and other resources how to resolve the issue, but I don't fully understand what to do. So, can somebody please instruct what changes I should make in the code?

The only way to solve this so far, is to put ALL code in a single cpp-file. Also if I comment out the Person person; line, the application will run.
Thank you for your assistance.


  #2 (permalink)  
Old April 14th, 2006, 02:44 PM
Registered User
Join Date: Apr 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Problem solved. ClassPerson.cpp (ClassPerson.h by mistake on text above) was not compiled.

Similar Threads
Thread Thread Starter Forum Replies Last Post
error lnk2019 Paula222 C++ Programming 3 February 27th, 2006 08:53 AM
error lnk2019 Paula222 Visual C++ 0 February 7th, 2006 06:03 PM
error LNK2020 unresolved token rachappa Visual C++ 1 January 12th, 2006 08:05 AM
Link Problems with"unresolved external symbols" ConstantineAugustus Visual C++ 2 November 22nd, 2005 06:34 AM
error LNK2019: unresolved external symbol tinawalt VS.NET 2002/2003 3 August 9th, 2005 07:59 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.