-4
我的問題很奇怪。 在visual c++
我想用fuzzylite library
創建一個DLL。 當我創建我的類,它的形式(myclass.h
,myclass.cpp
)使用庫項目編譯罰款。 和fuzzylite頭被包含在myclass.h
fuzzylite的Visual C++奇怪的行爲
,但如果我在myclass.cpp
或增加(#include 「fl/Headers.h」
)頂部添加(#include 「stdafx.h」
)到stdafx.h
我得到100 errors
。 有什麼想法?
更新1:
//FuzzyCalc.h
#pragma once
#define __DLL_EXPORTS
#ifdef __DLL_EXPORTS
#define __DLL_API __declspec(dllexport)
#else
#define __DLL_API __declspec(dllimport)
#endif
class __DLL_API FuzzyCalc
{
public:
FuzzyCalc();
~FuzzyCalc();
double getOutputValue(double val1, double val2);
};
//FuzzyCalc.cpp
#include "fl/Headers.h"
#include "FuzzyCalc.h"
FuzzyCalc::FuzzyCalc()
{
}
FuzzyCalc::~FuzzyCalc()
{
}
double FuzzyCalc::getOutputValue(double val1, double val2)
{
return 0.0;
}
直到此時每一件事情是正常的程序編譯和構建成功的,但如果我補充一點:
#include "stdafx.h"
#include "fl/Headers.h"
#include "FuzzyCalc.h"
FuzzyCalc::FuzzyCalc()
{
}
FuzzyCalc::~FuzzyCalc()
{
}
double FuzzyCalc::getOutputValue(double val1, double val2)
{
return 0.0;
}
我得到一些錯誤,如thease:
Error C2146 syntax error: missing ')' before identifier 'a' fuzzyind fuzzylite\fl\Operation.h 41
Error C2365 'T': redefinition; previous definition was 'template parameter' fuzzyind \fuzzylite\fl\Operation.h 41
Error C2061 syntax error: identifier 'a' fuzzyind \fuzzylite\fl\Operation.h 41
Error C2059 syntax error: ')' fuzzyind \fuzzylite\fl\Operation.h 41
Error C2334 unexpected token(s) preceding ':'; skipping apparent function body fuzzyind \fuzzylite\fl\Operation.h 41
Error C2988 unrecognizable template declaration/definition fuzzyind \fuzzylite\fl\term\Term.h 37
Error C2143 syntax error: missing ';' before 'namespace' fuzzyind \fuzzylite\fl\term\Term.h 37
Error C1004 unexpected end-of-file found fuzzyind fuzzyind\dllmain.cpp 19
只是添加一行,每事情出錯了。
建立一個樣品是主要的,你需要的標題。然後逐行添加所需的功能,直到停止編譯。如果這不會使問題變得明顯,請編輯您的問題以添加您的代碼。這就是我們所說的MCVE,但您已經知道,因爲您已閱讀網站幫助以及有關如何編寫好問題的部分。 – user4581301