开发者

Finding an absolute path to a folder in Cygwin

I am running a Eclipse for C/C++ using cygwin GCC. I need to get the library path of "libws2_32.a"开发者_如何学C, which is in C:\cygwin\lib\w32api for me in windows. However I do not understand how this is translated into a cygwin-path.

I've tried stuff like:

/cygdrive/c/cygwin/lib/w32api
/lib/w32api
/usr/lib/w32api

Any ideas?

EDIT: update

Here's the make Eclipse log used for building, if it helps:

make all 
Building target: Filesharing_core.dll
Invoking: Cygwin C Linker
gcc -L/cygdrive/c/cygwin/lib/w32api -shared -o"Filesharing_core.dll"  ./src/test.o   -llibws2_32.a
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibws2_32.a
collect2: ld returned 1 exit status
make: *** [Filesharing_core.dll] Error 1


It's not a problem with the path; it's a problem with the name of the library (the -l option). Where you have entered libws2_32.a, instead enter ws2_32.
See the GCC manual for how the -l option works.

Generally, when asking for help with programming, don't describe, but show. Don't describe what you're doing; don't describe what you think the error is. Instead, show exactly what you're doing, show the exact code (or a cut down version that exhibits the same problem), and show the exact error message.
This way others don't have to guess as to what's wrong, and you are more likely to receive an answer right away that solves your problem.


You can use the find utility to find the file, although it may take a while.

find / -name libws2_32.a -print

Edit: Based on your edit to the question, simply move -llibws2_32.a to before ./src/test.o.


The folder C:\Opt\Cygwin\lib\w32api or whatever it is in your system is simply /lib/w32api from within Cygwin. The library you're looking for is /lib/w32api/libws2_32.a.

But I'm not sure what you're trying to achieve. I guess your Eclipse in running in Windows, and not from a Cygwin'ized version of Java? Why are you using Cygwin GCC? Do you want to compile for Cygwin? If not, MinGW or TDM-GCC would be the tool to pick.

If you do want to compile for the Cygwin environment using Eclipse (a combination I haven't tried), then user experience like the following might be helpful:

http://www.benjaminarai.com/benjamin_arai/index.php?display=/eclipsecygwingcc.php

(I simply googled: eclipse cygwin gcc)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜