Can't find erf, erff, etc. compiling under 10.2

235 views Asked by At

I try to compile C++ Mathematical Expression Library (http://www.partow.net/programming/exprtk/index.html) by Arash Parto. Unfort. I do not succeed using 10.2. erf, erff, etc. are not found.

File try to compile:

#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;
}

=======================================

Error log:

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'

After Remy Lebau's advice I tried the following

@RemyLebeau: Thanks for your advice. However I feel so useless.....

I tried (of course no **):

    **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 Error] exprtk.hpp(1199): no member named 'erff' in the global namespace

Then I tried:

    #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,**std**::erff)
    exprtk_define_erf(     double,**std**::erf )
    exprtk_define_erf(long double,**std**::erfl)
    #undef exprtk_define_erf
    #endif

==> [bcc32c Error] exprtk.hpp(1198): no member named 'erff' in namespace 'std'

New 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;
}

After modifiying in #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

I get now: [ilink32 Error] Fatal: Exceeded memory limit for block Publics in module File2.cpp

1

There are 1 answers

0
ExprTk Developer On

The C++ compiler provided by C++ Builder is typically not a standards conforming compiler neither is the standard library that is provided alongside the compiler.

Newer versions of C++ builder for the 64-bit target use clang/llvm, which should resolve the issue you're seeing.