C++ 搜索向量[包含错误的版本、原始代码和生成文件] 它给出了这么多的错误,为什么 我怎样才能修好它

C++ 搜索向量[包含错误的版本、原始代码和生成文件] 它给出了这么多的错误,为什么 我怎样才能修好它,c++,C++,我的真实代码 int SearchUserName ( string searched, vector<User *> list ) { vector<User *> :: iterator it ; for ( it = list.begin() ; it < list.end ( ) ; ++it ) { const string tmp = (*it) -> getUsername() ; if ( tmp ==

我的真实代码

 int  SearchUserName (  string searched,   vector<User *> list  )   {
 vector<User *> :: iterator it ;
 for ( it = list.begin() ; it < list.end ( ) ; ++it ) {
    const  string tmp = (*it) -> getUsername() ;
    if ( tmp  == searched ) return 1 ;
 }     
return 0 ;
}
  // SocialNet :: createUser
  void SocialNet :: createUser (const string username, const string name, \
                          const string surname)   throw ( SocialNetException ) {
  int tmp = SearchUserName ( username, this -> users ) ;
  if(  tmp  == 0) {
     User *tmp = NULL ;
     tmp = new User( username, name, surname ) ;
     users.push_back ( tmp ) ;     
       return ;
 }
 throw  SocialNetException (USER_ALREADY_EXISTS, username)  ; 
}

编撰;让文件名注释所有代码。并取消一行又一行的注释,以确定导致问题的行。

注释所有代码。并逐行取消注释,以确定是哪一行导致了问题。

我感到很幸运

class people
{
public: // <--- add this line

    string getpersonname();

};
班级人员
{
公众://我感到很幸运

class people
{
public: // <--- add this line

    string getpersonname();

};
班级人员
{

public://您只编译了一个文件

差不多

main: foo.o bar.o
    $(CXX) -o $@ foo.o bar.o

列出所有对象文件

您只编译了一个文件

差不多

main: foo.o bar.o
    $(CXX) -o $@ foo.o bar.o


列出您的所有对象文件

我认为您的链接器错误是由一个.cpp文件未编译到程序中造成的。

我认为您的链接器错误是由一个.cpp文件未编译到程序中造成的。

如果您发布错误。我们不知道。我们可能知道您是否发布了这些错误。一些错误消息可能会有所帮助。但是条件it使用命名空间std
放弃n、 我建议我们都给出一些可能导致错误的东西。你的解决方案是:某些方法可能是非公开的。这将是关于这一点回答最多的问题。我的问题是
使用namespace std
遗忘。