1

Consider I want to build a shared library from my C++ file foo.cpp. The file has dependencies on various libraries, e.g. a b c, i.e., -la -lb -lc. Under linux, I can do this for example with the following call:

g++ -shared -o foo.so foo.cpp

Note that I do not have to specify -la -lb -lc here. The linker simply ignores all unresolved symbols.

When I tried the same thing under windows in a cygwin environment, I got linker errors telling me that symbols from the libraries a b and c where not found. I had to add -la -lb -lc to the command:

g++ -shared -o foo.dll foo.cpp -la -lb -lc

This works, however, this slows down the process considerably, since the symbol tables of the libraries have to be read. How can I build a .dll with cygwin without having to specify the libraries I needs, i.e., how can I make the cygwin g++ do the same thing the linux g++ does.

gexicide
  • 38,535
  • 21
  • 92
  • 152
  • This may be answered here: http://stackoverflow.com/questions/17601949/building-a-shared-library-using-gcc-on-linux-and-mingw-on-windows – Anon Mail Nov 10 '15 at 19:44

0 Answers0