类定义文件中存在Win32程序编译器错误
Win32 program compiler errors in class definition file
我正在尝试用Visual C++进行编译,并刚刚将此配置文件加载器/解析器添加到我的项目中。对于类CProfileData中定义的某些函数,它至少接收到两个错误中的一个:
missing type specifier - int assumed.
syntax error : missing ',' before '&'
显然,这应该只是一个引用字符串
#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;
};
包括<string>
:
#include <string>
在你写过string
的地方写std::string
。
在头文件中执行以下任一操作都不是一个好主意:
using namespace std; //avoid doing this
using std::string; //avoid doing this as well
确保在包含以下标题之前出现这两行:
#include <string>
using std::string;
相关文章:
- 在gcc中意外调用了Const重载.编译器错误或兼容性修复程序
- 如何编译使用从不同编译器编译的库的应用程序?
- 如何使用CLion和MSVC编译器工具链编译wxWidgets Hello World应用程序而没有错误?
- 为什么我的程序无法在GDB在线编译器/调试器或Visual Studio C++ 2019中运行
- 是否可以将不同的编译器嵌入到我的应用程序中?
- C++使用较新的编译器构建应用程序,而无需重新构建库
- C++程序编译器在使用g++命令编译后自动运行exe文件
- 我正在调试这个C++程序.编译器不再显示语法错误,但存在隐藏的逻辑错误
- 编译 Fortran 和C++程序并从英特尔编译器链接
- CMake 和 Visual Studio 2015 - C 编译器 cl.exe 无法编译简单的测试程序
- C++编译器 g++.exe 无法编译简单的测试程序 - 确定 CXX 编译器是否工作失败
- JIT 编译器及其在 C++ 前面加快 .NET 中程序执行速度的好处
- 在线编译器 - 等待输入并自动馈送输入时拦截程序
- G :内部编译器错误:分割故障(程序CC1PLUS) - 我在哪里开始
- GCC编译器,为较低版本的GCC编译应用程序
- 在C++程序中使用 libcurl 会导致 Visual C++ 编译器发出错误
- 如何将我的控制台应用程序链接到使用 clang++ 作为编译器的 OSX 环境中的 /usr/local/lib 中存在
- 编译器将私人构造函数作为程序代码中的候选人提供
- Arm GNU编译器:通过多余的强制转换优化的三进制生成的程序集
- 类定义文件中存在Win32程序编译器错误