- 下载源码:https://github.com/taku910/crfpp.git
- 进入目录:
./configure
make
sudo make install
无论是ubuntu,还是macos,执行make时,一般会出现如下错误:
g++ -DHAVE_CONFIG_H -I. -O3 -Wall -c -o crf_learn.o crf_learn.cpp
g++ -DHAVE_CONFIG_H -I. -O3 -Wall -c -o crf_test.o crf_test.cpp
crf_learn.cpp:9:21: fatal error: winmain.h: No such file or directory
#include "winmain.h"
- ubuntu解决方案
./configure
sed -i '/#include "winmain.h"/d' crf_test.cpp
sed -i '/#include "winmain.h"/d' crf_learn.cpp
make
sudo make install
- macos解决方案
./configure
sed -i '.bak' '/#include "winmain.h"/d' crf_test.cpp
sed -i '.bak' '/#include "winmain.h"/d' crf_learn.cpp
make
sudo make install
该博客介绍了在Ubuntu和MacOS系统中安装CRF++时遇到的`winmain.h`文件缺失错误。提供了解决方案,包括使用`sed`命令删除包含错误头文件的行,然后执行`make`和`sudo make install`来完成安装过程。

669

被折叠的 条评论
为什么被折叠?



