请看以下文件:(这是一个完整的文件)
#ifndef TEES_ALGORITHM_LIBRARY_WRAPPER_H
#define TEES_ALGORITHM_LIBRARY_WRAPPER_H
#ifdef _TEES_COMPILE_AS_LIB
#include <dfa\Includes\DFC_algorithms.hpp>
#include <DFA\FuzzyClassifier\FuzzyAlgorithmIntialization\InitFuzzyAlgorithm.hpp>
typedef teesalgorithm::tees_fuzzy_algorithms algorithms_switchyard_class;
#else
#include <DFA\Includes\commercial_algorithms.hpp>
//An incomplete class to hide implementation
class algorithms_switchyard_class;
#endif
class AlgorithmLibraryWrapper {
algorithms_switchyard_class * algorithmPtr_;
typedef teesalgorithm::tees_paramObj paramObj_type;
typedef teesalgorithm::tees_errorObj errorObj_type;
typedef teesalgorithm::tees_statusObj statusObj_type;
typedef teesalgorithm::tees_dataObj dataObj_type;
typedef teesalgorithm::tees_outputObj outputObj_type;
public:
AlgorithmLibraryWrapper(const std::string& sAlgName, paramObj_type& paramObj, errorObj_type& errObj, statusObj_type& statusObj, const char* sFilePath);
static bool dataReader(const std::string& sFileName, dataObj_type& dataObj, errorObj_type& errObj, statusObj_type& statusObj);
bool runalgorithm(const dataObj_type& dataObj, outputObj_type& outObj, errorObj_type& errObj, statusObj_type& statusObj);
~AlgorithmLibraryWrapper();
};
#ifdef _TEES_USE_COMPILED_ALGORITHM_LIB
# ifdef _MSC_VER
#if _MSC_VER < 1400 // If VC 2003
#ifdef _DEBUG
#error No AlgorithmLibWrapper libraries compiled for this version of VC
#else
#error No AlgorithmLibWrapper libraries compiled for this version of VC
#endif
#elif defined(UNDER_CE) // Win CE
#ifdef _DEBUG
#pragma comment( lib, "AlgorithmLibWrapperCEd" )
#else
#pragma comment( lib, "AlgorithmLibWrapperCE" )
#endif
#else // If VC 2005
#ifdef _DEBUG
#pragma comment( lib, "AlgorithmLibWrapperd" )
#else
#pragma comment( lib, "AlgorithmLibWrapper" )
#endif
#endif
#endif
#endif
#endif //TEES_ALGORITHM_LIBRARY_WRAPPER_H我得到了以下错误,我不知道为什么。我还手动计算了预处理指令。
AlgorithmLibraryWrapper.hpp:10:1:未终止#ifdef AlgorithmLibraryWrapper.hpp:7:1:未终止#ifndef
我正在使用可怜的vxWorks gcc编译器。请告诉我是我的错还是编译器的错。
发布于 2009-02-20 00:07:53
问题可能在于所包含的文件(如果实际存在未平衡的#if/#endif)。
我会尝试用另一个编译器进行预处理。你可以用gcc来做这件事,不管它不会编译。只要让gcc (或者MinGW,如果你在Windows上)并运行
cpp -Iinclude_direcories your_file或者,如果你不喜欢gcc,得到MSVC快报版。同样,您可以对甚至不编译的代码进行预处理,因此不工作库等方面没有问题。
大多数编译器都有一个选项,它将为您提供来自预处理器的输出,这样您就可以检查它正在做什么。例如,
gcc -E file.c >file.preproc将给出预处理的源代码,这样您就可以检查#if与#endif之间的平衡。
发布于 2009-02-20 00:08:49
据猜测,您的其中一个文件#(包括此文件中的文件)有一个不匹配的#ifdef/#endif对。您需要查看所有的文件(就像预处理程序所做的那样),而不仅仅是这个文件。
发布于 2009-02-20 00:48:21
正如其他人所指出的,这很可能是由于不匹配的包括警卫。
如果您所包含的文件在您的控制下(即不是第三方封闭源代码库的一部分),您可以考虑替换#ifndef et。阿尔。保护(用于防止多个包含)使用#杂注一次。这将消除出现预处理器指令不匹配的可能性。
有一点要注意的是,普拉格玛是不标准的,所以只有在编译器支持它的情况下,它才能工作。
https://stackoverflow.com/questions/567788
复制相似问题