Error while compiling Example #1

Submitted by BenDiet on Sun, 08/14/2022 - 09:42
Forums

Hello everyone,

I'm a computer science student and working on a project, which involves
the usage of a NLP-tool like FreeLing. My question is probably based on a
easy to see mistake I made, but I can't solve it my self. So I was hoping
someone here could help me with that.

I'm currently trying to compile example 1 on my Linux system
and get the following error:

FAILED: CMakeFiles/test_freeling.dir/main.cpp.o
/usr/bin/c++ -g -std=gnu++17 -MD -MT CMakeFiles/test_freeling.dir/main.cpp.o -MF CMakeFiles/test_freeling.dir/main.cpp.o.d -o CMakeFiles/test_freeling.dir/main.cpp.o -c /home/ben/Schreibtisch/Bachelor_Projekt/test_freeling/main.cpp
In file included from /usr/include/freeling/morfo/idioma.h:45,
from /usr/include/freeling/morfo/lang_ident.h:44,
from /usr/include/freeling.h:35,
from /home/ben/Schreibtisch/Bachelor_Projekt/test_freeling/main.cpp:2:
/usr/include/freeling/morfo/smoothingLD.h: In constructor ‘freeling::smoothingLD::smoothingLD(const wstring&, const std::map, E>&)’:
/usr/include/freeling/morfo/smoothingLD.h:129:73: error: there are no arguments to ‘log’ that depend on a template parameter, so a declaration of ‘log’ must be available [-fpermissive]
129 | if (name==L"LinearDiscountAlpha") { double a; sin>>a; alpha = log(a); notalpha=log(1-a); }
| ^~~
/usr/include/freeling/morfo/smoothingLD.h:129:73: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/include/freeling/morfo/smoothingLD.h:129:90: error: there are no arguments to ‘log’ that depend on a template parameter, so a declaration of ‘log’ must be available [-fpermissive]
129 | if (name==L"LinearDiscountAlpha") { double a; sin>>a; alpha = log(a); notalpha=log(1-a); }
| ^~~
/usr/include/freeling/morfo/smoothingLD.h:179:18: error: there are no arguments to ‘log’ that depend on a template parameter, so a declaration of ‘log’ must be available [-fpermissive]
179 | pUnseen = -log(vsize-ntypes); // log version of 1/(vsize-ntypes)
| ^~~
/usr/include/freeling/morfo/smoothingLD.h:180:14: error: there are no arguments to ‘log’ that depend on a template parameter, so a declaration of ‘log’ must be available [-fpermissive]
180 | nobs = log(nobs);
| ^~~
ninja: build stopped: subcommand failed.

I didn't change anything of the example and don't really know what I did wrong.
I also tried to compile it with the terminal and used the command:

g++ example.cc -o example -lfreeling -std=c++0x

The same error appeared.
Did I install FreeLing wrong in any way or should I link another lib or something?
Thanks to everyone helping me.

That is ok.  The error is caused by a missing "using std::log" in smoothingLD.h, so adding it somewhere is the proper solution.

It is already fixed in the git master branch, smoothingLD.h already has the "using std:log" line

thanks!