How would you compile multiple c++ files that are using SDL2 and sqlite3 on a Raspberry Pi 3? 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++?
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. 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.
因此,为了使用预链接的库进行编译,必须在终端中运行以下命令:
$ 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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.