By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

vector declaration inside class

P: n/a
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

Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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


Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.