gpt4 book ai didi

c++ - Raspberry Pi 使用 SQLite3 和 SDL2 编译多个 C++ 文件

转载 作者:行者123 更新时间:2023-11-28 05:10:39 24 4
gpt4 key购买 nike

如何在 Raspberry Pi 3 上编译使用 SDL2 和 sqlite3 的多个 c++ 文件?如果设置是在 Raspberry Pi 3 上使用 g++ 编译的 6 个 cpp 文件,并且这些文件中的每一个都使用了 SDL2 库,并且 2 个使用了 sqlite3.c 和 sqlite3.h 文件,那么 g++ 的命令是什么样的?

我已经在我的 Rasberry Pi 3 上安装了 SDL2、SDL2_image 和 SDL2_ttf,我在文件中有 sqlite3.c 和 sqlite3.h 文件以及所有 cpp 文件。我试过这个命令:

g++ -std=c++0x Source.cpp Basic_Image.cpp Clock.cpp Text.cpp Widget.cpp TextDatabase.cpp -o Source `sdl2-config --cflags --libs` -LSDL2_image -lSDL2_ttf

并收到此错误:

/usr/bin/ld: cannot open output file -I/usr/local/include/SDL2: No such file or directory Collect2: error: ld returned 1 exit status.

SDL2 安装在我的 Raspberry Pi 3 上,所以为什么它不会抛出这样的文件或目录让我感到困惑。

最佳答案

因此,为了使用预链接库进行编译,您必须在终端中运行以下命令:

$ g++ -std=c++0x Source.cpp Basic_Image.cpp CLock.cpp Text.cpp Widget.cpp TextDatabase.cpp -o Source $(pkg-config --libs --cflags sdl2 SDL2_image SDL2_ttf sqlite3)

关于c++ - Raspberry Pi 使用 SQLite3 和 SDL2 编译多个 C++ 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43578235/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com