Raspberry Pi 使用 SQLite3 和 SDL2 编译多个 C++ 文件
Raspberry Pi Compiling multiple C++ Files with SQLite3 and SDL2
如何在 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)
如何在 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)