Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > vector declaration inside class

Reply
Thread Tools

vector declaration inside class

 
 
Venkat
Guest
Posts: n/a
 
      12-20-2003
Hi All,

I am getting unusual compile errors when i declare a vector as a private
member of a class in .h file,
but if i declare the same in .cpp file inside the definition of a function
which is a member of the same class it is working fine.

Here is my .h file

#include <wtypes.h>
#include <string>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <Winsock2.h>

class A{
private:
std::string ExtractServerFromDSN(std::string& dsn);
long CheckPublisher();
std::string m_Database;
std::string m_DSN;
std::string m_Server;
std::string m_UserID;
std::string m_UserPWD;
odbc::Connection *m_Con;
vector<string> CSVTagNameList;

public:
A(void);
~A();
long DBConnection();
int CIDPDBInstall::fn1(const std::string dialPlan);
int CIDPDBInstall::fn2(const std::string dialPlan);
// TODO: add your methods here.
};

CSVTagNameList vector declaration is giving problems, but the same if i use
in .cpp file inside a public function of above class A works fine.
Can someone tell me if i am missing anything.


regards,
Venkat



 
Reply With Quote
 
 
 
 
Jeff Schwab
Guest
Posts: n/a
 
      12-20-2003
Venkat wrote:
> Hi All,
>
> I am getting unusual compile errors when i declare a vector as a private
> member of a class in .h file,
> but if i declare the same in .cpp file inside the definition of a function
> which is a member of the same class it is working fine.
>
> Here is my .h file
>
> #include <wtypes.h>
> #include <string>
> #include <list>
> #include <map>
> #include <set>
> #include <vector>
> #include <Winsock2.h>
>
> class A{
> private:
> std::string ExtractServerFromDSN(std::string& dsn);
> long CheckPublisher();
> std::string m_Database;
> std::string m_DSN;
> std::string m_Server;
> std::string m_UserID;
> std::string m_UserPWD;
> odbc::Connection *m_Con;
> vector<string> CSVTagNameList;



std::vector<std::string> CSVTagNameList; // ITYM


>
> public:
> A(void);
> ~A();
> long DBConnection();
> int CIDPDBInstall::fn1(const std::string dialPlan);
> int CIDPDBInstall::fn2(const std::string dialPlan);
> // TODO: add your methods here.
> };
>
> CSVTagNameList vector declaration is giving problems, but the same if i use
> in .cpp file inside a public function of above class A works fine.
> Can someone tell me if i am missing anything.
>
>
> regards,
> Venkat
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Initializing vector<vector<int> > and other vector questions... pmatos C++ 6 04-26-2007 05:39 PM
Free memory allocate by a STL vector, vector of vector, map of vector Allerdyce.John@gmail.com C++ 8 02-18-2006 12:48 AM
"virtual outside class declaration" and "declaration does not declare anything" kelvSYC C++ 6 05-17-2005 08:58 AM
Function declaration in class declaration Ovidesvideo C++ 4 12-10-2004 06:36 PM
declaration of size of vector<vector<int> > Erik Borgstr?m C++ 3 02-17-2004 01:20 PM



Advertisments