搞定了。需要通过两步去编译,多谢多谢。
https://www.sfml-dev.org/tutorials/2.5/start-linux.php
1.
g++ -c main.cpp -I<sfml-install-path>/include
2.
g++ main.o -o sfml-app -L<sfml-install-path>/lib -lsfml-graphics -lsfml-window -lsfml-system
3. ./sfml-app
==================================================================================
我要用的第三方库是SFML,目录结构如下:
> tree -L 2
.
├── SFML
│ ├── Frameworks
│ ├── changelog.md
│ ├── doc
│ ├── examples
│ ├── extlibs
│ ├── include
│ ├── lib
│ ├── license.md
│ ├── readme.md
│ └── templates
├── hello.cpp
├── hello.dSYM
│ └── Contents
├── helloworld.cpp
├── helloworld.dSYM
│ └── Contents
├── images
│ ├── background.png
│ ├── frame.png
│ └── tiles.png
└── main.cpp
--------------------------------------------------------------
main.cpp部分代码:
#include <SFML/Graphics.hpp>
#include <time.h>
using namespace sf;
---------------------------------------------------------------
环境: MacOS, Clang
> clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
---------------------------------------------------------------
遇到困难, SFML这个库找不到:
fatal error: 'SFML/Graphics.hpp' file not found
#include <SFML/Graphics.hpp>
^~~~~~~~~~~~~~~~~~~
--
修改:qwersex FROM 98.126.155.*
FROM 120.229.88.*