类定义文件中的Win32程序编译器错误

jsc*_*ott 0 c++ winapi compiler-errors

我试图在Visual C++中编译,只是将此配置文件加载器/解析器添加到我的项目中.对于某些CPACileData类中定义的函数,它至少会收到两个错误之一:

missing type specifier - int assumed.
syntax error : missing ',' before '&'
Run Code Online (Sandbox Code Playgroud)

显然这应该是一个引用的字符串

#ifdef UVSS_EXPORTS
#define UVSS_API __declspec(dllexport)
#else
#define UVSS_API __declspec(dllimport)
#endif


class CProfileData
{

public:
    UVSS_API CProfileData(){};
    UVSS_API CProfileData(const string& profileFile);
    UVSS_API ~CProfileData(void);

    UVSS_API bool GetVariable( const string& sectionName, const string& variableName, string& valueRet );
    UVSS_API bool GetSection( const string& sectionName, SECTION_MAP **pMapRet );
    UVSS_API bool GetVariableW( const string& sectionName, const string& variableName, wstring& valueRet );
    UVSS_API bool GetVariableInt( const string& sectionName, const string& variableName, int *pIntRet );

private:
    void ToLower( string& str );
    void TrimWhitespace( string& str);   
    bool IsComment( const string& str );
    bool IsSection( const string& str, string& secName );
    bool IsVariable( const string& str, string& name, string& value );

    PROFILE_MAP         m_mapProfile;

};
Run Code Online (Sandbox Code Playgroud)

Naw*_*waz 6

包括<string>:

#include <string>
Run Code Online (Sandbox Code Playgroud)

std::string在你写的任何地方string.

文件中执行以下任一操作不是一个好主意:

using namespace std; //avoid doing this
using std::string;   //avoid doing this as well
Run Code Online (Sandbox Code Playgroud)