所以我只是手动安装了SFML 2.4.2库,并希望从第一个教程中编译示例代码:
ReferenceError: wrapper is not defined
在Ubuntu 16.04上,所有内容都使用g ++ 5.4.0和clang ++ 3.8.0进行编译,但是当我尝试运行该程序时,它会显示一个黑色窗口1秒钟并将其输出到终端:
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
我尝试安装最新的nvidia驱动程序并重新启动系统,但没有运气。我缺少一些依赖吗?
修改: 我尝试使用GDB进行调试,这是我得到的回溯:
*** Error in `./main': free(): invalid pointer: 0x000000000155cb08 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f2d572537e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f2d5725be0a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f2d5725f98c]
./main[0x4015d0]
./main[0x401580]
./main[0x401492]
./main[0x4013d1]
./main[0x401368]
./main(_ZN2sf6StringD2Ev+0x15)[0x401325]
./main[0x4010a6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f2d571fc830]
./main[0x400ed9]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:02 7080173 /home/octothorp/code/terrain_rendering/main
00601000-00602000 r--p 00001000 08:02 7080173 /home/octothorp/code/terrain_rendering/main
00602000-00603000 rw-p 00002000 08:02 7080173 /home/octothorp/code/terrain_rendering/main
01549000-0186b000 rw-p 00000000 00:00 0 [heap]
40144000-401e4000 rw-p 00000000 00:00 0
406bb000-406bd000 r-xs 00000000 08:02 262928 /tmp/.gljLFg1G (deleted)
4081a000-408ba000 rw-p 00000000 00:00 0
7f2d4c000000-7f2d4c021000 rw-p 00000000 00:00 0
7f2d4c021000-7f2d50000000 ---p 00000000 00:00 0
7f2d517fa000-7f2d518c3000 rw-p 00000000 00:00 0
7f2d518c3000-7f2d518c8000 r-xp 00000000 08:02 795718 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f2d518c8000-7f2d51ac7000 ---p 00005000 08:02 795718 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f2d51ac7000-7f2d51ac8000 r--p 00004000 08:02 795718 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f2d51ac8000-7f2d51ac9000 rw-p 00005000 08:02 795718 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f2d51ac9000-7f2d51ad2000 r-xp 00000000 08:02 795710 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f2d51ad2000-7f2d51cd1000 ---p 00009000 08:02 795710 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f2d51cd1000-7f2d51cd2000 r--p 00008000 08:02 795710 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f2d51cd2000-7f2d51cd3000 rw-p 00009000 08:02 795710 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f2d51cf5000-7f2d51d75000 rw-s 1e3593000 00:06 591 /dev/nvidiactl
7f2d51d75000-7f2d51df5000 rw-s 1e3512000 00:06 591 /dev/nvidiactl
7f2d51df5000-7f2d51e75000 rw-s 1e348a000 00:06 591 /dev/nvidiactl
7f2d51e75000-7f2d51f75000 rw-s 1eb766000 00:06 591 /dev/nvidiactl
7f2d51f75000-7f2d51f88000 rw-s 1eb5f8000 00:06 591 /dev/nvidiactl
7f2d51f88000-7f2d51fa8000 rw-s c03c0000 00:06 592 /dev/nvidia0
7f2d51fa8000-7f2d51fe8000 rw-s 1eb6cb000 00:06 591 /dev/nvidiactl
7f2d51fe8000-7f2d52028000 rw-s 1eb574000 00:06 591 /dev/nvidiactl
7f2d52028000-7f2d521d9000 rw-p 00000000 00:00 0
7f2d521d9000-7f2d535d9000 r-xp 00000000 08:02 3030116 /usr/lib/nvidia-378/libnvidia-glcore.so.378.13
7f2d535d9000-7f2d535fa000 rwxp 01400000 08:02 3030116 /usr/lib/nvidia-378/libnvidia-glcore.so.378.13
7f2d535fa000-7f2d539cc000 r-xp 01421000 08:02 3030116 /usr/lib/nvidia-378/libnvidia-glcore.so.378.13
7f2d539cc000-7f2d53bcb000 ---p 017f3000 08:02 3030116 /usr/lib/nvidia-378/libnvidia-glcore.so.378.13
7f2d53bcb000-7f2d53fb7000 rw-p 017f2000 08:02 3030116 /usr/lib/nvidia-378/libnvidia-glcore.so.378.13
7f2d53fb7000-7f2d53fcf000 rw-p 00000000 00:00 0
7f2d53fcf000-7f2d53fd2000 r-xp 00000000 08:02 3030149 /usr/lib/nvidia-378/tls/libnvidia-tls.so.378.13
7f2d53fd2000-7f2d541d2000 ---p 00003000 08:02 3030149 /usr/lib/nvidia-378/tls/libnvidia-tls.so.378.13
7f2d541d2000-7f2d541d3000 rw-p 00003000 08:02 3030149 /usr/lib/nvidia-378/tls/libnvidia-tls.so.378.13
7f2d541d3000-7f2d5429d000 r-xp 00000000 08:02 3030139 /usr/lib/nvidia-378/libGLX_nvidia.so.378.13
7f2d5429d000-7f2d542d1000 rwxp 000ca000 08:02 3030139 /usr/lib/nvidia-378/libGLX_nvidia.so.378.13
7f2d542d1000-7f2d542e5000 r-xp 000fe000 08:02 3030139 /usr/lib/nvidia-378/libGLX_nvidia.so.378.13
7f2d542e5000-7f2d544e5000 ---p 00112000 08:02 3030139 /usr/lib/nvidia-378/libGLX_nvidia.so.378.13
7f2d544e5000-7f2d5450d000 rw-p 00112000 08:02 3030139 /usr/lib/nvidia-378/libGLX_nvidia.so.378.13
7f2d5450d000-7f2d54514000 rw-p 00000000 00:00 0
7f2d54514000-7f2d54519000 r-xp 00000000 08:02 795714 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f2d54519000-7f2d54718000 ---p 00005000 08:02 795714 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f2d54718000-7f2d54719000 r--p 00004000 08:02 795714 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f2d54719000-7f2d5471a000 rw-p 00005000 08:02 795714 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f2d5471a000-7f2d5471c000 r-xp 00000000 08:02 795703 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f2d5471c000-7f2d5491c000 ---p 00002000 08:02 795703 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f2d5491c000-7f2d5491d000 r--p 00002000 08:02 795703 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f2d5491d000-7f2d5491e000 rw-p 00003000 08:02 795703 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f2d5491e000-7f2d54927000 r-xp 00000000 08:02 795736 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f2d54927000-7f2d54b26000 ---p 00009000 08:02 795736 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f2d54b26000-7f2d54b27000 r--p 00008000 08:02 795736 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f2d54b27000-7f2d54b28000 rw-p 00009000 08:02 795736 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f2d54b28000-7f2d54b4c000 r-xp 00000000 08:02 2101871 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f2d54b4c000-7f2d54d4b000 ---p 00024000 08:02 2101871 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f2d54d4b000-7f2d54d4c000 r--p 00023000 08:02 2101871 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f2d54d4c000-7f2d54d4d000 rw-p 00024000 08:02 2101871 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f2d54d4d000-7f2d54d66000 r-xp 00000000 08:02 2101920 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f2d54d66000-7f2d54f65000 ---p 00019000 08:02 2101920 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f2d54f65000-7f2d54f66000 r--p 00018000 08:02 2101920 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f2d54f66000-7f2d54f67000 rw-p 00019000 08:02 2101920 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f2d54f67000-7f2d54f88000 r-xp 00000000 08:02 797052 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f2d54f88000-7f2d55187000 ---p 00021000 08:02 797052 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f2d55187000-7f2d55188000 r--p 00020000 08:02 797052 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f2d55188000-7f2d55189000 rw-p 00021000 08:02 797052 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f2d55189000-7f2d5518d000 r-xp 00000000 08:02 2097793 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f2d5518d000-7f2d5538c000 ---p 00004000 08:02 2097793 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f2d5538c000-7f2d5538d000 r--p 00003000 08:02 2097793 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f2d5538d000-7f2d5538e000 rw-p 00004000 08:02 2097793 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f2d5538e000-7f2d553dc000 r-xp 00000000 08:02 3030118 /usr/lib/nvidia-378/libGLdispatch.so.0
7f2d553dc000-7f2d5540e000 r-xp 0004e000 08:02 3030118 /usr/lib/nvidia-378/libGLdispatch.so.0
7f2d5540e000-7f2d55448000 r-xp 00080000 08:02 3030118 /usr/lib/nvidia-378/libGLdispatch.so.0
7f2d55448000-7f2d55648000 ---p 000ba000 08:02 3030118 /usr/lib/nvidia-378/libGLdispatch.so.0
7f2d55648000-7f2d55657000 rw-p 000ba000 08:02 3030118 /usr/lib/nvidia-378/libGLdispatch.so.0
7f2d55657000-7f2d55677000 rw-p 00000000 00:00 0
7f2d55677000-7f2d55686000 r-xp 00000000 08:02 3030153 /usr/lib/nvidia-378/libGLX.so.0
7f2d55686000-7f2d55886000 ---p 0000f000 08:02 3030153 /usr/lib/nvidia-378/libGLX.so.0
7f2d55886000-7f2d55887000 rw-p 0000f000 08:02 3030153 /usr/lib/nvidia-378/libGLX.so.0
7f2d55887000-7f2d558a7000 rw-p 00000000 00:00 0
7f2d558a7000-7f2d558aa000 r-xp 00000000 08:02 2100368 /lib/x86_64-linux-gnu/libdl-2.23.so
7f2d558aa000-7f2d55aa9000 ---p 00003000 08:02 2100368 /lib/x86_64-linux-gnu/libdl-2.23.so
7f2d55aa9000-7f2d55aaa000 r--p 00002000 08:02 2100368 /lib/x86_64-linux-gnu/libdl-2.23.so
7f2d55aaa000-7f2d55aab000 rw-p 00003000 08:02 2100368 /lib/x86_64-linux-gnu/libdl-2.23.so
7f2d55aab000-7f2d55ab5000 r-xp 00000000 08:02 795734 /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
7f2d55ab5000-7f2d55cb4000 ---p 0000a000 08:02 795734 /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
7f2d55cb4000-7f2d55cb5000 r--p 00009000 08:02 795734 /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
7f2d55cb5000-7f2d55cb6000 rw-p 0000a000 08:02 795734 /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
7f2d55cb6000-7f2d55cbd000 r-xp 00000000 08:02 2100360 /lib/x86_64-linux-gnu/librt-2.23.so
7f2d55cbd000-7f2d55ebc000 ---p 00007000 08:02 2100360 /lib/x86_64-linux-gnu/librt-2.23.so
7f2d55ebc000-7f2d55ebd000 r--p 00006000 08:02 2100360 /lib/x86_64-linux-gnu/librt-2.23.so
7f2d55ebd000-7f2d55ebe000 rw-p 00007000 08:02 2100360 /lib/x86_64-linux-gnu/librt-2.23.so
7f2d55ebe000-7f2d55ed6000 r-xp 00000000 08:02 2100382 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f2d55ed6000-7f2d560d5000 ---p 00018000 08:02 2100382 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f2d560d5000-7f2d560d6000 r--p 00017000 08:02 2100382 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f2d560d6000-7f2d560d7000 rw-p 00018000 08:02 2100382 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f2d560d7000-7f2d560db000 rw-p 00000000 00:00 0
7f2d560db000-7f2d56132000 r-xp 00000000 08:02 796440 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f2d56132000-7f2d56332000 ---p 00057000 08:02 796440 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f2d56332000-7f2d56333000 r--p 00057000 08:02 796440 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f2d56333000-7f2d56334000 rw-p 00058000 08:02 796440 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f2d56334000-7f2d563d8000 r-xp 00000000 08:02 796120 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.12.1
7f2d563d8000-7f2d565d7000 ---p 000a4000 08:02 796120 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.12.1
7f2d565d7000-7f2d565dd000 r--p 000a3000 08:02 796120 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.12.1
7f2d565dd000-7f2d565de000 rw-p 000a9000 08:02 796120 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.12.1
7f2d565de000-7f2d565ef000 r-xp 00000000 08:02 795716 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f2d565ef000-7f2d567ee000 ---p 00011000 08:02 795716 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f2d567ee000-7f2d567ef000 r--p 00010000 08:02 795716 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f2d567ef000-7f2d567f0000 rw-p 00011000 08:02 795716 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f2d567f0000-7f2d56925000 r-xp 00000000 08:02 795699 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f2d56925000-7f2d56b25000 ---p 00135000 08:02 795699 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f2d56b25000-7f2d56b26000 r--p 00135000 08:02 795699 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f2d56b26000-7f2d56b2a000 rw-p 00136000 08:02 795699 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f2d56b2a000-7f2d56b40000 r-xp 00000000 08:02 795623 /usr/lib/x86_64-linux-gnu/libICE.so.6.3.0
7f2d56b40000-7f2d56d3f000 ---p 00016000 08:02 795623 /usr/lib/x86_64-linux-gnu/libICE.so.6.3.0
7f2d56d3f000-7f2d56d40000 r--p 00015000 08:02 795623 /usr/lib/x86_64-linux-gnu/libICE.so.6.3.0
7f2d56d40000-7f2d56d41000 rw-p 00016000 08:02 795623 /usr/lib/x86_64-linux-gnu/libICE.so.6.3.0
7f2d56d41000-7f2d56d44000 rw-p 00000000 00:00 0
7f2d56d44000-7f2d56d4b000 r-xp 00000000 08:02 795695 /usr/lib/x86_64-linux-gnu/libSM.so.6.0.1
7f2d56d4b000-7f2d56f4a000 ---p 00007000 08:02 795695 /usr/lib/x86_64-linux-gnu/libSM.so.6.0.1
7f2d56f4a000-7f2d56f4b000 r--p 00006000 08:02 795695 /usr/lib/x86_64-linux-gnu/libSM.so.6.0.1
7f2d56f4b000-7f2d56f4c000 rw-p 00007000 08:02 795695 /usr/lib/x86_64-linux-gnu/libSM.so.6.0.1
7f2d56f4c000-7f2d56f7e000 r-xp 00000000 08:02 3030150 /usr/lib/nvidia-378/libGL.so.1.0.0
7f2d56f7e000-7f2d56fb0000 r-xp 00032000 08:02 3030150 /usr/lib/nvidia-378/libGL.so.1.0.0
7f2d56fb0000-7f2d56fda000 r-xp 00064000 08:02 3030150 /usr/lib/nvidia-378/libGL.so.1.0.0
7f2d56fda000-7f2d571da000 ---p 0008e000 08:02 3030150 /usr/lib/nvidia-378/libGL.so.1.0.0
7f2d571da000-7f2d571db000 rw-p 0008e000 08:02 3030150 /usr/lib/nvidia-378/libGL.so.1.0.0
7f2d571db000-7f2d571dc000 rw-p 00000000 00:00 0
7f2d571dc000-7f2d5739b000 r-xp 00000000 08:02 2100370 /lib/x86_64-linux-gnu/libc-2.23.so
7f2d5739b000-7f2d5759b000 ---p 001bf000 08:02 2100370 /lib/x86_64-linux-gnu/libc-2.23.so
7f2d5759b000-7f2d5759f000 r--p 001bf000 08:02 2100370 /lib/x86_64-linux-gnu/libc-2.23.so
7f2d5759f000-7f2d575a1000 rw-p 001c3000 08:02 2100370 /lib/x86_64-linux-gnu/libc-2.23.so
7f2d575a1000-7f2d575a5000 rw-p 00000000 00:00 0
7f2d575a5000-7f2d575bb000 r-xp 00000000 08:02 2101769 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2d575bb000-7f2d577ba000 ---p 00016000 08:02 2101769 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2d577ba000-7f2d577bb000 rw-p 00015000 08:02 2101769 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2d577bb000-7f2d578c3000 r-xp 00000000 08:02 2100380 /lib/x86_64-linux-gnu/libm-2.23.so
7f2d578c3000-7f2d57ac2000 ---p 00108000 08:02 2100380 /lib/x86_64-linux-gnu/libm-2.23.so
7f2d57ac2000-7f2d57ac3000 r--p 00107000 08:02 2100380 /lib/x86_64-linux-gnu/libm-2.23.so
7f2d57ac3000-7f2d57ac4000 rw-p 00108000 08:02 2100380 /lib/x86_64-linux-gnu/libm-2.23.so
7f2d57ac4000-7f2d57c36000 r-xp 00000000 08:02 787980 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f2d57c36000-7f2d57e36000 ---p 00172000 08:02 787980 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f2d57e36000-7f2d57e40000 r--p 00172000 08:02 787980 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f2d57e40000-7f2d57e42000 rw-p 0017c000 08:02 787980 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f2d57e42000-7f2d57e46000 rw-p 00000000 00:00 0
7f2d57e46000-7f2d57e53000 r-xp 00000000 08:02 3015624 /usr/lib/libsfml-system.so.2.4.2
7f2d57e53000-7f2d58052000 ---p 0000d000 08:02 3015624 /usr/lib/libsfml-system.so.2.4.2
7f2d58052000-7f2d58053000 rw-p 0000c000 08:02 3015624 /usr/lib/libsfml-system.so.2.4.2
7f2d58053000-7f2d58075000 r-xp 00000000 08:02 3015627 /usr/lib/libsfml-window.so.2.4.2
7f2d58075000-7f2d58275000 ---p 00022000 08:02 3015627 /usr/lib/libsfml-window.so.2.4.2
7f2d58275000-7f2d58276000 rw-p 00022000 08:02 3015627 /usr/lib/libsfml-window.so.2.4.2
7f2d58276000-7f2d58277000 rw-p 00000000 00:00 0
7f2d58277000-7f2d582c4000 r-xp 00000000 08:02 3015633 /usr/lib/libsfml-graphics.so.2.4.2
7f2d582c4000-7f2d584c3000 ---p 0004d000 08:02 3015633 /usr/lib/libsfml-graphics.so.2.4.2
7f2d584c3000-7f2d584c5000 rw-p 0004c000 08:02 3015633 /usr/lib/libsfml-graphics.so.2.4.2
7f2d584c5000-7f2d584c6000 rw-p 00000000 00:00 0
7f2d584c6000-7f2d584d6000 r-xp 00000000 08:02 2100348 /lib/x86_64-linux-gnu/ld-2.23.so
7f2d584d6000-7f2d584d7000 r-xp 00010000 08:02 2100348 /lib/x86_64-linux-gnu/ld-2.23.so
7f2d584d7000-7f2d584ec000 r-xp 00011000 08:02 2100348 /lib/x86_64-linux-gnu/ld-2.23.so
7f2d584f2000-7f2d58512000 rw-s 1eb561000 00:06 591 /dev/nvidiactl
7f2d58512000-7f2d58532000 rw-s 1eb65b000 00:06 591 /dev/nvidiactl
7f2d58532000-7f2d58572000 rw-s a20b8000 00:06 591 /dev/nvidiactl
7f2d58572000-7f2d58592000 rw-s a214e000 00:06 591 /dev/nvidiactl
7f2d58592000-7f2d58697000 rw-s 0ade7000 00:06 591 /dev/nvidiactl
7f2d58697000-7f2d586a1000 rw-p 00000000 00:00 0
7f2d586a1000-7f2d586bf000 r-xp 00000000 08:02 2097534 /lib/x86_64-linux-gnu/libudev.so.1.6.4
7f2d586bf000-7f2d586c0000 r--p 0001d000 08:02 2097534 /lib/x86_64-linux-gnu/libudev.so.1.6.4
7f2d586c0000-7f2d586c1000 rw-p 0001e000 08:02 2097534 /lib/x86_64-linux-gnu/libudev.so.1.6.4
7f2d586c1000-7f2d586c7000 rw-p 00000000 00:00 0
7f2d586d1000-7f2d586d2000 rw-p 00000000 00:00 0
7f2d586d2000-7f2d586d4000 rw-s 00000000 08:02 262928 /tmp/.gljLFg1G (deleted)
7f2d586d4000-7f2d586d5000 rw-s 1eb5f7000 00:06 591 /dev/nvidiactl
7f2d586d5000-7f2d586d9000 rw-s 1eb5f3000 00:06 591 /dev/nvidiactl
7f2d586d9000-7f2d586da000 rw-s cfde6000 00:06 592 /dev/nvidia0
7f2d586da000-7f2d586e5000 rw-p 00000000 00:00 0
7f2d586e5000-7f2d586e6000 rw-s cfde6000 00:06 592 /dev/nvidia0
7f2d586e6000-7f2d586e7000 rw-s cfde6000 00:06 592 /dev/nvidia0
7f2d586e7000-7f2d586e8000 rw-s 343e7000 00:06 591 /dev/nvidiactl
7f2d586e8000-7f2d586e9000 rw-s fa060000 00:06 592 /dev/nvidia0
7f2d586e9000-7f2d586eb000 rw-p 00000000 00:00 0
7f2d586eb000-7f2d586ec000 r--p 00025000 08:02 2100348 /lib/x86_64-linux-gnu/ld-2.23.so
7f2d586ec000-7f2d586ed000 rw-p 00026000 08:02 2100348 /lib/x86_64-linux-gnu/ld-2.23.so
7f2d586ed000-7f2d586ee000 rw-p 00000000 00:00 0
7ffd483cb000-7ffd483ec000 rw-p 00000000 00:00 0 [stack]
7ffd483f8000-7ffd483fa000 r--p 00000000 00:00 0 [vvar]
7ffd483fa000-7ffd483fc000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)
答案 0 :(得分:0)
所以答案应该是:自己构建SFML 2.4.2。但是,在编译简单的SFML示例代码时,使用我自己构建的SFML也会产生错误,这次是在链接阶段由于Ubuntu中的一些已知错误。虽然有一个简单的解决方法:
Download the SFML source code. Unpack it. Navigate to the root directory of the unzipped source code.
vim ./SFML/src/SFML/Graphics/CMakeLists.txt
Find the line on about line 149 -ish... yours may be different, since this is line 149 AFTER I made changes... which reads:
149 # ImageLoader.cpp must be compiled with the -fno-strict-aliasing
150 # when gcc is used; otherwise saving PNGs may crash in stb_image_write
151 if(SFML_COMPILER_GCC)
152 set_source_files_properties(${SRCROOT}/ImageLoader.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
153 endif()
Add the following lines BELOW
156 if(SFML_COMPILER_GCC AND BUILD_SHARED_LIBS)
157 message(WARNING "Applying workaround for https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899")
158 list(APPEND GRAPHICS_EXT_LIBS "-lgcc_s -lgcc")
159 endif()
Then cd to root dir of unpacked source
cmake .
make all
sudo make install
我在SFML论坛上发现:http://en.sfml-dev.org/forums/index.php?topic=20638.0。
如果您不关心可以使用apt-get安装的Ubuntu存储库中的最新版本,还有SFML 2.3。