如何解决找不到在10.2下编译的erf,erff等
我尝试通过arash Parto编译C ++数学表达式库(http://www.partow.net/programming/exprtk/index.html)。难受我无法成功使用10.2。找不到erf,erff等。
文件尝试编译:
#pragma hdrstop
#pragma argsused
#ifdef _WIN32
#include <tchar.h>
#else
typedef char _TCHAR;
#define _tmain main
#endif
#include <stdio.h>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include "exprtk.hpp"
#ifdef exprtk_test_float32_type
typedef float numeric_type;
#else
typedef double numeric_type;
#endif
some defs...
int _tmain(int argc,_TCHAR* argv[])
{
#define perform_test(Type,Number)
int result = 0;
perform_test(numeric_type,00)
#undef perform_test
return result;
}
=====================================
错误日志:
Project "D:_Entwicklung.KEL\exprtk_new\Project2.cbproj" (Build target(s)):
Target CreateProjectDirectories:
Creating directory ".\Win32\Debug".
Compiling C++ files...
Target MakeObjs:
Target TCCompile:
C:\Program Files (x86)\JomiTech\TwineCompile\mtbcc32.exe -ide102 -priority0 -files="D:_Entwicklung.KEL\exprtk_new\twfiles.@@@"
JomiTech TwineCompile 4.5 - copyright JomiTech 2016. All Rights Reserved.
Compiling 1 files...
Embarcadero C++ 7.30 for Win32 copyright (c) 1993-2017 Embarcadero Technologies,Inc.
d:_Entwicklung.KEL\exprtk_new\File2.cpp
File2.cpp: (0) 0 of 0
File2.cpp: (0) 368546 of 368546
d:_Entwicklung.KEL\exprtk_new\exprtk.hpp(1200,49): C++ error E2268: Call to undefined function 'erff'
在雷米·勒鲍(Remy Lebau)的建议下,我尝试了以下方法
@RemyLebeau:谢谢您的建议。但是我觉得没用.....
我尝试过(当然没有**):
**using namespace std;**
#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || !defined(_MSC_VER)
#define exprtk_define_erf(TT,impl) \
inline TT erf_impl(TT v) { return impl(v); } \
exprtk_define_erf( float,::erff)
exprtk_define_erf( double,::erf )
exprtk_define_erf(long double,::erfl)
#undef exprtk_define_erf
#endif
==> [bcc32c错误] exprtk.hpp(1199):全局名称空间中没有名为“ erff”的成员
然后我尝试了:
#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || !defined(_MSC_VER)
#define exprtk_define_erf(TT,**std**::erff)
exprtk_define_erf( double,**std**::erf )
exprtk_define_erf(long double,**std**::erfl)
#undef exprtk_define_erf
#endif
==> [bcc32c错误] exprtk.hpp(1198):命名空间“ std”中没有名为“ erff”的成员
新file2.cpp
#pragma hdrstop
#pragma argsused
#ifdef _WIN32
#include <tchar.h>
#else
typedef char _TCHAR;
#define _tmain main
#endif
using namespace std;
#include "exprtk.hpp"
template <typename T>
void trig_function()
{
typedef exprtk::symbol_table<T> symbol_table_t;
typedef exprtk::expression<T> expression_t;
typedef exprtk::parser<T> parser_t;
//
const std::string expression_string =
"clamp(-1.0,sin(2 * pi * x) + cos(x / 2 * pi),+1.0)";
T x;
symbol_table_t symbol_table;
symbol_table.add_variable("x",x);
symbol_table.add_constants();
expression_t expression;
expression.register_symbol_table(symbol_table);
parser_t parser;
parser.compile(expression_string,expression);
//
for (x = T(-5); x <= T(+5); x += T(0.001))
{
const T y = expression.value();
printf("%19.15f\t%19.15f\n",x,y);
}
}
int _tmain(int argc,_TCHAR* argv[])
{
trig_function<double>();
int result = 0;
return result;
}
在#include“ exprtk.hpp”中进行修改后:
#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || !defined(_MSC_VER)
#define exprtk_define_erf(TT,impl) \
inline TT erf_impl(TT v) { return impl(v); } \
// exprtk_define_erf( float,::erff)
exprtk_define_erf( double,::erf )
// exprtk_define_erf(long double,::erfl)
#undef exprtk_define_erf
#endif
我现在得到: [ilink32错误]致命:模块File2.cpp中的公共块的内存超出限制
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。