[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

uses undefined class???

Posted on 2004-08-21
3
Medium Priority
?
671 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

649 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