anopheles
anopheles

Reputation: 434

Compiling Python project in C++. How do I include linked library

Hi fellow stackoverflowers,

I want to compile a SWIG project with g++ using following command:

g++ -shared python/swig_wrap.o  -IC:/Python27/include/ -lpython2.7 -o python/_lib.so

Unfortunately, g++ or rather ld.exe complains that it can't find -lpython2.7

c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lpython2.7

How do I specify where the library resides on my hard drive or do I have to compile it first from the python source?

Upvotes: 2

Views: 291

Answers (1)

lucasg
lucasg

Reputation: 11002

Try :

g++ -shared python/swig_wrap.o  -IC:/Python27/include/ -LC:/Python27/libs -lpython27 -o python/_lib.so

It should normally work.

Upvotes: 2

Related Questions