c++ vscode 第三方库_请教下,vscode中怎么编译带第三方库的文件呢?谢谢! - C++程序设计语言 - CPlusPlus ...

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 02:14   59   0

搞定了。需要通过两步去编译,多谢多谢。

https://www.sfml-dev.org/tutorials/2.5/start-linux.php

1.

g++ -c main.cpp -I/include

2.

g++ main.o -o sfml-app -L/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

#include

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

^~~~~~~~~~~~~~~~~~~

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP