使用C ++中的sfml进行python扩展时出错

时间:2017-07-16 01:46:54

标签: python c++ sfml

我对C ++一无所知

并尝试在python中进行扩展以检查是否使用了SFML C ++代码和在python中的使用将起作用

setup.py

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

但是出现了这个错误:

{{1}}

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您似乎忘了在命令中链接到某些库。 我发现了一些你可以链接到的库。将其添加到编译器命令并使用您自己的安装路径交换<sfml-install-path>

-L<sfml-install-path>/lib -lsfml-graphics -lsfml-window -lsfml-system