CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    40

    Unhappy what do I am missing

    I trying to link array.h,.cpp: Linkedlist.h,.cpp with a Hastable.h, .cpp, in the main program
    useHashTables.cpp// what do I am missing


    useHashTables.cpp.text+0x1cb): undefined reference to `HashTable<MyStruct>::HashTable(int (*)(MyStruct const&), int)'
    useHashTables.cpp.text+0x1e6): undefined reference to `HashTable<MyStruct>::HashTable(int (*)(MyStruct const&), int)'
    useHashTables.cpp.text+0x21d): undefined reference to `HashTable<MyStruct>::insert(MyStruct const&)'
    useHashTables.cpp.text+0x249): undefined reference to `HashTable<MyStruct>::insert(MyStruct const&)'
    useHashTables.cpp.text+0x279): undefined reference to `HashTable<MyStruct>::retrieve(MyStruct&)'
    useHashTables.cpp.text+0x2e7): undefined reference to `HashTable<MyStruct>::retrieve(MyStruct&)'

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: what do I am missing

    When using templates, the implementation must be in the header itself.

    One way to do this is, instead of compiling Hashtable.cpp directly, just put

    #include "Hashtable.cpp"
    at the end of Hashtable.h.

  3. #3
    Join Date
    Mar 2009
    Posts
    40

    Red face Re: what do I am missing

    Thanks that work.

    by the way....

    One question, I have a Phonebook class that open a texfile with all data and display it
    I want to call from this hash table.

    can you give to me a idea for think clear what to take in considerations when develop the program?

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