Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Pls Help (http://www.go4expert.com/forums/pls-help-t3858/)

nutty boy 13Apr2007 23:22

Pls Help
 
Hi
I'm using MS Visual Studio 2005 and have made a class called "Stack_Class" whiich consist of "class.cpp" and "class.h"
when i made a c++ program and i want to use "stack_class" i added just a refrencs to the header file class.h
like this
#include <C:\Visual Studio 2005\Projects\stack\stack\Stack.h>
in the main program file(.cpp)
Then compiled my program it gives the following errors
1>Main.obj:error LNK2019: unresolved external symbol "public: __thiscall Stack_Class::~Stack_Class(void)" (??1Stack_Class@@QAE@XZ) referenced in function _main
1>Main.obj:error LNK2019: unresolved external symbol "public: int __thiscall Stack_Class::Pop_It(int *)" (?Pop_It@Stack_Class@@QAEHPAH@Z) referenced in function _main
1>Main.obj:error LNK2019: unresolved external symbol "public: int __thiscall Stack_Class::Push_It(int)" (?Push_It@Stack_Class@@QAEHH@Z) referenced in function _main
1>Main.obj:error LNK2019: unresolved external symbol "public: __thiscall Stack_Class::Stack_Class(unsigned char)" (??0Stack_Class@@QAE@E@Z) referenced in function _main
1>C:\Visual Studio 2005\Projects\Test_Stack\Debug\Test_Stack.exe : fatal error LNK1120: 4 unresolved externals
but when i added the"stack.cpp" to the main program file(.cpp)
it works fine ---->Why
when i'm use function like printf i only include the "stdio.h" without its associated .cpp file
thanks

DaWei 13Apr2007 23:45

Re: Pls Help
 
We don't know how your project is set up, but probably not like that. Put your .h file in the same directory as your source file and include it like this: #include "Stack.h". If you want it in a subdirectory for some reason, use #include "mysubdirectory/Stack.h". The brackets (<>) are used for files which are to be found on the include path you have specified in your settings.

FURTHERMORE: if you haven't read the "Before you make a query" thread, please do that now. I don't want to say your subject title is stupid, but I'm strongly tempted to. How is the next visitor going to search for technical information if all the subjects say "Pls Help"?? I'm also of the opinion that a person who types 'pls' instead of 'please' belongs in a chat room instead of a programming forum, because programming requires accuracy and correct syntax.

nutty boy 14Apr2007 02:47

Re: Pls Help
 
Hi DaWei
Thanks 4 ur reply and i want u to know that i'm newbie in c++ programming so i asked this Question also i promise that i will concern about ur advices


All times are GMT +5.5. The time now is 07:07.