CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    14

    [RESOLVED]LNK2019 unresolved external symbol problem

    Hi,

    I'm new to c++ and have an issue with the LNK2019 error. I've done some googling and as of yet haven't found a solution to my problem. So here I am!!

    The exact error I receive is: error LNK2019: unresolved external symbol "public: void __thiscall ProductInfo::create_product(int)" (?create_product@ProductInfo@@QAEXH@Z) referenced in function _wmain OOSD_Assignment.obj OOSD_Assignment

    Essentially as soon as I add any datetypes to the function call's in the .h file it throws a wobbler, e.g. here: void create_product(int);



    and the code for you:

    ProductInfo.h ----->

    #include "stdafx.h"
    #include <iostream>
    //#include <windows.h>
    #include <string.h>
    using namespace std;

    class ProductInfo
    {
    public:

    //std::string inp_model;


    void create_product(int);

    };



    ProductInfo.cpp ------>

    //ProductInfo.cpp - Our class that holds information about the products

    #include "stdafx.h"
    #include <iostream>
    //#include <string.h>
    using namespace std;

    int price;

    void create_product(int input_price) {
    price = input_price;

    }



    Project1.cpp -------->


    #include "stdafx.h"
    #include "ProductInfo.h"
    #include <iostream>
    #include <string.h>

    //int argc, _TCHAR* argv[]

    using namespace std;

    int _tmain()
    {

    //std::string xx("hello");
    int xx = 100293;
    ProductInfo test;

    test.create_product(xx);


    return 0;
    }



    Cheers.

    Dave
    Last edited by skycrazy123; February 24th, 2009 at 11:11 AM. Reason: Problem Resolved

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured