簡體   English   中英

Decimal.h C ++庫錯誤

[英]Decimal.h C++ library errors

我正在PPP Bjarne Stroustrup書上學習C ++。 在第四章中,我意識到了雙重不精確問題,並且我開始尋找一些替代方法(十進制類型)。

我找到了這個庫,但是我的編譯器在lib文件中顯示了一些錯誤。

Description Resource    Path    Location    Type
'::max' has not been declared   chapter4.drill      line 46, external location: C:\Users\GAMEOVER\Documents\Libaries\decimal_for_cpp-master\include\decimal.h   C/C++ Problem
Description Resource    Path    Location    Type
'numeric_limits' is not a member of 'std'   chapter4.drill      line 46, external location: C:\Users\GAMEOVER\Documents\Libaries\decimal_for_cpp-         master\include\decimal.h  C/C++ Problem
Description Resource    Path    Location    Type
expected primary-expression before '>' token    chapter4.drill      line 46,   external location: C:\Users\GAMEOVER\Documents\Libaries\decimal_for_cpp-master\include\decimal.h C/C++ Problem

您可以在此處看到46行:

#ifndef DEC_NO_CPP11
#include <cstdint>
46. #define DEC_MAX_INT32 (std::numeric_limits<int32_t>::max())
#else
#ifndef DEC_EXTERNAL_LIMITS

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif

#if defined(__GXX_EXPERIMENTAL_CXX0X) || (__cplusplus >= 201103L)
#include <cstdint>
#else
#include <stdint.h>
#endif

#endif

#define DEC_MAX_INT32 INT32_MAX

#endif

我將Eclipse與MinGW + GCC(4.8.1)配合使用,我將編譯器設置為使用C ++ 11

*如果您有任何建議可以改善我的問題,請說出來。

就像Dieter所說的那樣,您只需包括以下內容即可解決問題:

 #include <limits>

我希望可以幫助其他人。

現在已在GitHub存儲庫中進行了更正。 請在GitHub上注冊與此庫相關的問題-否則您可能會在這里被其他人(?)否決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM