简体   繁体   English

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

[英]Raspberry Pi Compiling multiple C++ Files with SQLite3 and SDL2

How would you compile multiple c++ files that are using SDL2 and sqlite3 on a Raspberry Pi 3? 您将如何在Raspberry Pi 3上编译使用SDL2和sqlite3的多个c ++文件? If the setup was 6 cpp files being compiled using g++ on a Raspberry Pi 3, and each of those files used the SDL2 library, and 2 used the sqlite3.c and sqlite3.h files, what would the command look like for g++? 如果设置是在Raspberry Pi 3上使用g ++编译的6个cpp文件,并且每个文件都使用SDL2库,而2个文件使用了sqlite3.c和sqlite3.h文件,那么对于g ++,该命令将是什么样?

I have installed SDL2, SDL2_image, and SDL2_ttf on my Rasberry Pi 3 and I have the sqlite3.c and sqlite3.h files inside of the file with all of the cpp files. 我已经在Rasberry Pi 3上安装了SDL2,SDL2_image和SDL2_ttf,并且在文件内部包含sqlite3.c和sqlite3.h文件以及所有cpp文件。 I've tried this command: 我已经尝试过以下命令:

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

and received this error: 并收到此错误:

/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 is installed on my Raspberry Pi 3, so why it would throw no such file or directory confuses me. 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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM