Пожалуйста, посмотрите на следующий файл: (это полный файл)C++ препроцессор неожиданных ошибок компиляции
#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 компилятор. Пожалуйста, дайте мне знать, является ли ошибка моей или компилятором.
Я не считаю излишним endif. Они, похоже, подходят мне. Отступ большого блока мне не по душе, но все же соответствует. Если вы имеете в виду конечный endif, это включенный охранник, который был запущен вверху. – paxdiablo
Нет, я не имел в виду финал, но преоиус. Тем не менее, вы правы, это правильно. – jpalecek
@jpalecek, «gcc -E» сгенерирует вывод препроцессора в stdout, который вы можете проверить на баланс. Я добавил, что, надеюсь, вы не против. – paxdiablo