Errors after installing

Submitted by wildseeker91 on Fri, 04/27/2018 - 12:42
Forums

I am trying to use FreeLing with a C++ project in Visual Studio 2017. After going through a lot of pain of linking the library to my code, when I try to use it, i get errors (code C2589) in io-sentence.h and io-dep.h saying '(': illegal token on right side of '::'.

wildseeker91

Fri, 04/27/2018 - 13:01

I figured this out. There's some problem with including windows.h that it makes std::max and min macros. I changed the library by putting () around std::max. Earlier I was getting this error
LNK1104 cannot open file 'libboost_regex-vc140-mt-gd-1_60.lib'
Now I am getting this again. I searched for this file on my computer, it doesn't seem to be there.

You need to deactivate some non-standard MSVC options.

Specifically, you need to add the following defiinitions to your compilation commands:

_CRT_SECURE_NO_WARNINGS=1
_CRT_NONSTDC_NO_DEPRECATE=1
NOMINMAX
NDEBUG=1
WIN32=1
_CONSOLE=1

I will add this to the manual, in case someone else has the same problem

Regarding the missing libboost, if you managed to compile FreeLing, it must be there (otherwise, cmake would have complained, and nmake would have not worked).

If you followed the installation instructions, you downloaded a binary version of libboost, and uncompressed it somewhere. Just find ount where it is and add it to your link paths.

 

 

wildseeker91

Wed, 05/02/2018 - 06:05

I copied and pasted the sample program in the manual, but I am still getting errors.
First I got iterator errors. I changed the list::iterator and sentence::iterator to not const, and commented word::iterator out. When I run the program after that, I get a Microsoft C++ Exception in freeling-test.exe (name of my project): std::runtime_error at memory location ...

Which sample program are you refering to ?? 

Please use src/main/simple_examples/sample.cc

That should have no problems with const iterators.  If there are, please post the exact error an line number.

If you changed freeling code or code in sample.cc, please go back to original versions.

wildseeker91

Wed, 05/02/2018 - 20:50

I am getting errors with the cmake command.

Here is my CMakeErrorLog:

Determining if the include file pthread.h exists failed with the following output:
Change Dir: C:/Users/Satvik/of_v0.9.8_vs_release/apps/myApps/freeling/FreeLing/build/CMakeFiles/CMakeTmp

Run Build Command:"nmake" "/NOLOGO" "cmTC_62f51\fast"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_62f51.dir\build.make /nologo -L CMakeFiles\cmTC_62f51.dir\build

Building C object CMakeFiles/cmTC_62f51.dir/CheckIncludeFile.c.obj

C:\PROGRA~2\MICROS~4\2017\COMMUN~1\VC\Tools\MSVC\1413~1.261\bin\Hostx86\x86\cl.exe @C:\Users\Satvik\AppData\Local\Temp\nm86EE.tmp

CheckIncludeFile.c

C:\Users\Satvik\of_v0.9.8_vs_release\apps\myApps\freeling\FreeLing\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~4\2017\COMMUN~1\VC\Tools\MSVC\1413~1.261\bin\Hostx86\x86\cl.exe' : return code '0x2'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX86\x86\nmake.exe"' : return code '0x2'

Stop.

wildseeker91

Thu, 05/03/2018 - 01:30

Test FreeLing Installation on Windows, Execute FreeLing demo and Call FreeLing Library all have links that don't work in the user manual

I fixed the manual links, thanks for pointing it out.

If you have problems with cmake, then you did not build freeling, so there is no point in trying to compile a program that calls the library.

It seems it can not find pthread. CMake is platform-aware and if your win32 threads library is installed, it should be able to find it.  If it is intalled in some non-standard path, you may need to provide it to cmake command. Google about "cmake pthread missing windows" for some possibilities.

Which cmake version are you using? I used cmake 3.10 and it worked fine on Windows 10