build link error

1>------ Build started: Project: Circular_Link_List, Configuration: Debug x64 ------
1>Build started 12/30/2012 11:36:28 AM.
1>PrepareForBuild:
1> Creating directory "C:\Users\RIJIN\documents\visual studio 2010\Projects\Circular_Link_List\x64\Debug\".
1>InitializeBuildStatus:
1> Creating "x64\Debug\Circular_Link_List.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> main.cpp
1> ListNode.cpp
1> Circular_Linklist.cpp
1> Generating Code...
1>main.obj : error LNK2019: unresolved external symbol "public: class ListNode<int> * __cdecl CircularLinkedList<int>::find(int)" (?find@?$CircularLinkedList@H@@QEAAPEAV?$ListNode@H@@H@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl CircularLinkedList<int>::remove(int)" (?remove@?$CircularLinkedList@H@@QEAAXH@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "public: int __cdecl CircularLinkedList<int>::size(void)" (?size@?$CircularLinkedList@H@@QEAAHXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl CircularLinkedList<int>::display_all(void)" (?display_all@?$CircularLinkedList@H@@QEAAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl CircularLinkedList<int>::insertA(int,int)" (?insertA@?$CircularLinkedList@H@@QEAAXHH@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl CircularLinkedList<int>::insertB(int)" (?insertB@?$CircularLinkedList@H@@QEAAXH@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "public: __cdecl CircularLinkedList<int>::CircularLinkedList<int>(void)" (??0?$CircularLinkedList@H@@QEAA@XZ) referenced in function main
1>C:\Users\RIJIN\documents\visual studio 2010\Projects\Circular_Link_List\x64\Debug\Circular_Link_List.exe : fatal error LNK1120: 7 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.04
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Umm maybe your code will help .

All those unresolved externals means that you have not written the implementation code for those functions. Make sure spelling, capitalization, and parameters are correct in all the *.cpp files.

Attaching codes
1. when i AM USING TEMPLATES ITS SHOWING ABOVE ERROR
2. WITHOUT USING TEMPLATES ITS RUNNING FINE.....I THINK THE PROBLEM IS WITH FUNCITON TEMPLATES......CAN ANYONE HELP ME TO SOLVE THIS...?

Attaching codes
1. when i AM USING TEMPLATES ITS SHOWING ABOVE ERROR
2. WITHOUT USING TEMPLATES ITS RUNNING FINE.....I THINK THE PROBLEM IS WITH FUNCITON TEMPLATES......CAN ANYONE HELP ME TO SOLVE THIS...?

The problem is that you put the implementation code in separate *.cpp files instead of as inline code in the header files. You can easily prove this by replacing the constructor in the cpp file with inline code in the header file then recompiling. That will remove the constructor error. The reason is because templates can't be compiled before the data type is known. How is the template supposed to know what kind of data is Head when CircularLinkedList.cpp is compiled? It doesn't. This is one reason why you see a lot of inline code in template header files.

You're going to have to get rid of both *.cpp files (CircularLinkedList.cpp and ListNode.cpp) and move all that code into the header file as inline methods.

template <class T>
class CircularLinkedList{
public: 
    CircularLinkedList() {Head=NULL;} /* constructor */

@Ancient Dragon : What would i suppose to do?

I got ur point buddy, but how to solve other functions.....how can assign type before compile..?

Do the same with all the other functions. I already told you what you need to do to fix all the problems.

.how can assign type before compile..?

The type is assigned when you instantiate a template which is why you can't put the template's implementation code in a *.cpp file.

Is there any declaration prototype......will u modify that for me?

.will u modify that for me?

No. All you have to do is put all that code in the header file and delete the two *.cpp files.

ohh i see.....thax buddy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.