Solved

uses undefined class???

Posted on 2004-08-21
3
657 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 3

Author Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

691 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