Answer the question
In order to leave comments, you need to log in
How to fix libbson library linking error in Qt?
There is a need to use the libbson library https://github.com/mongodb/libbson written in C in a Qt project.
The library was built according to the instructions for Windows https://github.com/mongodb/libbson/blob/master/REA... using one of the proposed cmake generator "Visual Studio 11" (for Visual Studio 2012), msbuild.exe ALL_BUILD.vcxproj
and msbuild.exe INSTALL.vcxproj
were successful.
The library was installed in C:\install\path\.
In the .pro file of the Qt project, I connected the headers of the library
HEADERS += \
C:/install/path/include/libbson-1.0/bcon.h \
C:/install/path/include/libbson-1.0/bson.h \
C:/install/path/include/libbson-1.0/bson-atomic.h \
C:/install/path/include/libbson-1.0/bson-clock.h \
C:/install/path/include/libbson-1.0/bson-compat.h \
C:/install/path/include/libbson-1.0/bson-config.h \
C:/install/path/include/libbson-1.0/bson-context.h \
C:/install/path/include/libbson-1.0/bson-endian.h \
C:/install/path/include/libbson-1.0/bson-error.h \
C:/install/path/include/libbson-1.0/bson-iter.h \
C:/install/path/include/libbson-1.0/bson-json.h \
C:/install/path/include/libbson-1.0/bson-keys.h \
C:/install/path/include/libbson-1.0/bson-macros.h \
C:/install/path/include/libbson-1.0/bson-md5.h \
C:/install/path/include/libbson-1.0/bson-memory.h \
C:/install/path/include/libbson-1.0/bson-oid.h \
C:/install/path/include/libbson-1.0/bson-reader.h \
C:/install/path/include/libbson-1.0/bson-stdint.h \
C:/install/path/include/libbson-1.0/bson-stdint-win32.h \
C:/install/path/include/libbson-1.0/bson-string.h \
C:/install/path/include/libbson-1.0/bson-types.h \
C:/install/path/include/libbson-1.0/bson-utf8.h \
C:/install/path/include/libbson-1.0/bson-value.h \
C:/install/path/include/libbson-1.0/bson-version.h \
C:/install/path/include/libbson-1.0/bson-writer.h
LIBS += "C:\install\path\lib\bson-1.0.lib"
extern "C" {
#include "C:/install/path/include/libbson-1.0/bson.h"
}
bson_t *bsonobj = bson_new();
moc_TestApp.obj:-1: ошибка: LNK2019: ссылка на неразрешенный внешний символ bson_new в функции "protected: void __cdecl TestApp::usageBson(class QTextStream &)" ([email protected]@[email protected]@@Z)
Answer the question
In order to leave comments, you need to log in
If it's not important to use this particular lib, you can try QJson
habrahabr.ru/post/147952
And in Qt 5.0 there is doc-snapshot.qt-project.org/5.0/qjsondocument.html
Why do you include all libbson headers in the project?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question