问题描述
我想编译一个名为,这基本上告诉我使用:
My first search pointed me to cygwin, and then I followed several suggestions, like this one, which basically tells me to use:
gcc-3 -D __int64="long long" -mno-cygwin -Wl,--add-stdcall-alias
-I"<JAVA_HOME>\include" -I"<JAVA_HOME>\include\win32" -shared -o jbliss.dll *.cc
这使我主要遇到以下错误:
This brings me mainly to the following error:
bliss-0.50/timer.cc:2:23: sys/times.h: No such file or directory
,并找到,这表明使用 -I / usr / include /
。但是这将导致比解决更多的错误:
I googled this error, and found this post, which suggests to use -I /usr/include/
. But that will cause more errors than it solves:
In file included from /usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/bits/stl_algobase.h:67,
from /usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/bits/stl_tree.h:66,
from /usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/set:66,
from bliss-0.50/graph.cc:4:
/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/cstdlib:181: error: `::strtold' has not been declared
/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/cstdlib:200: error: `__gnu_cxx::strtold' has not been declared
所以我坐在现在困惑,希望得到一个答案,gcc的选择使用它正确。
我刚刚下载了cygwin,我会说我有最新的版本。
So I am sitting now puzzled and hoping for an answer, which options of gcc to use to get it right.I have just downloaded cygwin and I would say I have the lastest version.
提前感谢。
额外的本地信息:
$ which gcc
/usr/bin/gcc
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/WATCOM/BINNT:/cygdrive/c/WATCOM/BINW:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/QuickTime Alternative/QTSystem:/cygdrive/c/Program Files/TortoiseSVN/bin:/cygdrive/c/Program Files/MATLAB/R2011b/runtime/win64:/cygdrive/c/Program Files/MATLAB/R2011b/bin:/cygdrive/c/Program Files (x86)/OpenSSH/bin:/cygdrive/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/cygdrive/c/Program Files (x86)/Graphviz 2.28/bin
推荐答案
Googling进一步向我展示了sys / times.h不是(并且显然不应该是)在mingw可用。 sys / times.h下的include文件被认为是平台相关的,因此在windows上不支持。
Googling further shows me the fact that indeed sys/times.h is not (and apparently is not supposed to be) available on mingw. The include files under sys/times.h are said to be platform dependent and therefore not supported on windows.
解决方案是尽可能地删除对sys / times.h(或任何平台相关库)的任何调用。删除这些包含文件(当然向编译器添加适当的选项)可以成功构建。
The solution is to remove any call to sys/times.h (or any platform dependent library) as far as possible. Removing these include files (and of course adding proper options to the compiler) leads to a successful build.
这篇关于在Windows 7中编译JNI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!