我在C++錯誤在Python擴展與SFML在C++
沒有知識,並做一個擴展的python如果 C++代碼中使用SFML,並檢查在Python中使用會工作
設置。 PY
from distutils.core import setup, Extension
setup(name='init',
version='1.0',
ext_modules=[Extension('testemeu',['main.cpp'],include_dirs=[r"C:\Users\v\Documents\code\C\sml\SFML-2.4.2\include"],library_dirs = [r"C:\Users\v\Documents\code\C\sml\SFML-2.4.2\lib"])])
但這個錯誤顯示:
running build
running build_ext
building 'testemeu' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Users\v\Documents\code\C\sml\SFML-2.4.2
\include -IC:\Python34\include -IC:\Python34\include -c main.cpp -o build\temp.w
in32-3.4\Release\main.o
writing build\temp.win32-3.4\Release\testemeu.def
C:\MinGW\bin\g++.exe -shared -s build\temp.win32-3.4\Release\main.o build\temp.w
in32-3.4\Release\testemeu.def -LC:\Users\v\Documents\code\C\sml\SFML-2.4.2\lib -
LC:\Python34\libs -LC:\Python34\PCbuild -lpython34 -lmsvcr100 -o build\lib.win32
-3.4\testemeu.pyd
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x75): undefined reference t
o `_imp___ZN2sf6StringC1EPKcRKSt6locale'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x98): undefined reference t
o `_imp___ZN2sf9VideoModeC1Ejjj'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0xd1): undefined reference t
o `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettin
gsE'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0xf4): undefined reference t
o `_imp___ZNK2sf6Window6isOpenEv'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x119): undefined reference
to `_imp___ZN2sf6Window9pollEventERNS_5EventE'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x135): undefined reference
to `_imp___ZN2sf6Window5closeEv'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x13c): undefined reference
to `_imp___ZN2sf5Color5BlackE'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x14b): undefined reference
to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x15a): undefined reference
to `_imp___ZN2sf6Window7displayEv'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x192): undefined reference
to `_imp___ZN2sf12RenderWindowD1Ev'
build\temp.win32-3.4\Release\main.o:main.cpp:(.text+0x1af): undefined reference
to `_imp___ZN2sf12RenderWindowD1Ev'
collect2.exe: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
何w解決這個問題?
這些鏈接錯誤,這意味着在編譯過程中被發現的聲明,但是當它得到鏈接,它無法找到這些功能的定義。也許你忘了鏈接到一些圖書館? – Daniel