我的头文件中有一些错误,我不知道如何解决,因为我对C ++很陌生。

这是头文件的代码:

#pragma once

typedef unsigned int uint;

class DCEncryption
{
public:
    static char* manageData(char*, char*, uint);

private:
    static int max(int, int);
    static uint leftRotate(uint, int);
};


这是错误:

 - dcencryption.h(12): error C2062: type 'int' unexpected
 - dcencryption.h(12): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
 - dcencryption.h(12): error C2760: syntax error : expected '{' not ';'
 - dcencryption.h(13): error C2144: syntax error : 'uint' should be preceded by '}'
 - dcencryption.h(13): error C2143: syntax error : missing ')' before ';'
 - dcencryption.h(13): error C2059: syntax error : ')'
 - dcencryption.h(13): error C2143: syntax error : missing ';' before ')'
 - dcencryption.h(13): error C2238: unexpected token(s) preceding ';'

最佳答案

您可能在Windows上,并且在包含显示的文件之前,已直接或间接(可能是通过windef.h)从主windows.h文件包含了.cpp

碰巧maxwindef.h中定义的宏,在您的上下文中不能很好地扩展。

这在其他平台上也很容易发生。

关于c++ - C++头文件-语法问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10744558/

10-14 18:40
查看更多