I try to add the dll link to the Qt project. Previously downloaded for MiniGW.

pro file content

 win32:CONFIG(release, debug|release): LIBS += -L$$PWD/D:/test/sodium/lib/ -lsodium else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/D:/test/sodium/lib/ -lsodiumd else:unix: LIBS += -L$$PWD/D:/test/sodium/lib/ -lsodium INCLUDEPATH += $$PWD/D:/test/sodium/include DEPENDPATH += $$PWD/D:/test/sodium/include win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/D:/test/sodium/lib/libsodium.a else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/D:/test/sodium/lib/libsodiumd.a else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/D:/test/sodium/lib/sodium.lib else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/D:/test/sodium/lib/sodiumd.lib else:unix: PRE_TARGETDEPS += $$PWD/D:/test/sodium/lib/libsodium.a 

I try to enclose libu - writes No such file or directory

enter image description here

  • one
    So still dll or lib? And "to curb libu" is strange. Includes headlines. - Vladimir Martyanov
  • Sorry, to make it work)) add libu - Radzhab
  • one
    "I try to enclose lib - writes No such file or directory" - how do you do it? - Vladimir Martyanov

1 answer 1

 INCLUDEPATH += $$PWD/D:/test/sodium/include DEPENDPATH += $$PWD/D:/test/sodium/include 

this is the $$ PWD - means the directory in which the pro-file is located.

Use:

 INCLUDEPATH += D:/test/sodium/include DEPENDPATH += D:/test/sodium/include 

or

 INCLUDEPATH += $$PWD/..относительный_путь_к_файлам DEPENDPATH += $$PWD/..относительный_путь_к_файлам 

For libraries - similarly

For the library libsodium-win32: downloaded and unpacked, in my case the bin / include / lib folders are located in D:\newfolder\libsodium-win32

In the pro-file we write:

 INCLUDEPATH += D:\newfolder\libsodium-win32\include DEPENDPATH += D:\newfolder\libsodium-win32\include LIBS += -LD:\newfolder\libsodium-win32\lib -llibsodium 

after which this code compiles normally

 #include <sodium.h> int main(int argc, char *argv[]) { unsigned char *ch1 = 0; unsigned char *ch2 = 0; crypto_hash_sha256(ch1, ch2, 1000); return 0; } 

It is clear that in the crypto_hash_sha256 function it is necessary to transfer the correct values, and not as in my example. As in this case, the program will "fall" when you try to start.

  • And if I do not have a pro-file - Rajab
  • @Radzhab If you have a project in QtCreator, then the pro-file must be, with the help of it, make-files are generated and the program is compiled. Or are you using Visual Studio? - Alexander
  • I use Qt. There is another question. There is either. download.libsodium.org/libsodium/releases / ... How to pull it up in Qt so that I can use the method crypto_hash_sha256 - Radzhab
  • @Radzhab completed the answer - Alexander