简体   繁体   English

/src/DB/sqlite3.dll:无法识别文件:无法识别文件格式

[英]/src/DB/sqlite3.dll: file not recognized: File format not recognized

I am trying to include a sqlite3 in my cpp project but while compilation it gives below error: 我试图在我的cpp项目中包含sqlite3,但在编译时却出现以下错误:

g++ -c -std=c++11 -g src/Main.cpp -I"C:/Mycode/src/DB" -L"C:/Mycode/src/DB" -lsqlite3 g ++ -c -std = c ++ 11 -g src / Main.cpp -I“ C:/ Mycode / src / DB” -L“ C:/ Mycode / src / DB” -lsqlite3

g++ -g -o Main.exe Main.o Data.o SqliteApi.o -lws2_32 -L"C:/Mycode/src/DB" -lsqlite3 g ++ -g -o Main.exe Main.o Data.o SqliteApi.o -lws2_32 -L“ C:/ Mycode / src / DB” -lsqlite3

C:/Mycode/src/DB/sqlite3.dll: file not recognized: File format not recognized C:/Mycode/src/DB/sqlite3.dll:无法识别文件:无法识别文件格式

collect2.exe: error: ld returned 1 exit status collect2.exe:错误:ld返回1退出状态

make: ***[Mycode.exe] Error 1 make:*** [Mycode.exe]错误1

I feel during final linking time it gives error. 我觉得在最终链接期间它给出了错误。 I am using my own make file for compilation, below is the make command I am using: 我正在使用自己的make文件进行编译,以下是我正在使用的make命令:

DB_DIR="C:/Mycode/src/DB"

clean:
    rm Main.o Main.exe

Main.exe: Main.o Data.o SqliteApi.o 
    g++ -g -o Main.exe Main.o Data.o SqliteApi.o -lws2_32 -L${DB_DIR} -lsqlite3 

Main.o: src/Main.cpp
    g++ -c -std=c++11 -g src/Main.cpp -I${DB_DIR} -lsqlite3

Data.o: src/Data.cpp
    g++ -c -std=c++11 -g src/Data.cpp

SqliteApi.o: src/SqliteApi.cpp
    g++ -c -std=c++11 -g src/SqliteApi.cpp

I have googled but I couldn't find any solution or suggestion for this error. 我已经用Google搜索过,但是找不到此错误的任何解决方案或建议。 Any help will be much appreciated. 任何帮助都感激不尽。

The recommended way of using the SQLite library is to compile the amalgamation source file directly into your program: 建议使用SQLite库的方法是将合并源文件直接编译到程序中:

Main.exe: Main.o Data.o SqliteApi.o 
    g++ -g -o Main.exe Main.o Data.o SqliteApi.o sqlite3.o -lws2_32

sqlite3.o: src/sqlite3.c
    gcc -c ... src/sqlite3.c

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

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