Solved

uses undefined class???

Posted on 2004-08-21
3
613 Views
Last Modified: 2008-03-10
I've got:

/////////CPair.cpp:
class CPair{
   //stuff here...
}

//CPair::methods...


////////Main.cpp:
void someMethod(){
    CPair pair;
}

but it's complaining that the CPair class is undefined?!?!?! How can I get around this??? Maybe some header file? :S
0
Comment
Question by:Unimatrix_001
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
avizit earned 500 total points
ID: 11859625
generally you will have  a

1) Cpair.h file with the


class CPair{
   //stuff here...
}
 
and then a Cpair.cpp

2) Cpair.cpp which will have

#include "Cpair.h"

CPair::methods...

3.) Main.cpp

which will have

#include "CPair.h"

void someMethod(){
    CPair pair;
}


================
the reason you are getting is because the file main.cpp cannot see the declaration/definition of CPair




0
 
LVL 11

Expert Comment

by:avizit
ID: 11859659
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 11859761
Thank you :) ...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now