vector declaration inside class

Discussion in 'C++' started by Venkat, Dec 20, 2003.

  1. Venkat

    Venkat Guest

    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
    Venkat, Dec 20, 2003
    #1
    1. Advertising

  2. Venkat

    Jeff Schwab Guest

    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
    >
    >
    >
    Jeff Schwab, Dec 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Erik Borgstr?m
    Replies:
    3
    Views:
    2,631
    Erik Borgstr?m
    Feb 17, 2004
  2. Ovidesvideo
    Replies:
    4
    Views:
    502
    Andrey Tarasevich
    Dec 10, 2004
  3. kelvSYC
    Replies:
    6
    Views:
    7,226
    Richard Herring
    May 17, 2005
  4. Replies:
    8
    Views:
    1,914
    Csaba
    Feb 18, 2006
  5. Mehmet Yavuz S. Soyturk

    variable declaration inside eval inside with

    Mehmet Yavuz S. Soyturk, Apr 11, 2007, in forum: Javascript
    Replies:
    3
    Views:
    125
    Mehmet Yavuz S. Soyturk
    Apr 12, 2007
Loading...

Share This Page