Closed radimkohout closed 4 years ago
Hi
For the correct incude you need:
SUBDIRS += \
youProjectFolder
youProjectFolder.file = path/to/yuorProject.pro
* Open the Master project folder in git console. If git not install then install it [this](https://git-scm.com/download/win)
* run: git submodule add https://github.com/QuasarApp/Qt-Secret.git
* run: git submodule update --init --recursive
* Open Master.pro
* Add Qt-Secret library like submproject of Master
``` qmake
SUBDIRS += \
youProjectFolder \
Qt-Secret \
youProjectFolder.file = path/to/yuorProject.pro
include($$PWD/../Qt-Secret/src/Qt-Secret.pri)
* Rebuild Master project
* All done!. Now you nead to build only master project, because it will build both your project and the project Qt-Secret. QT-Secret will already be included to your project and you will be able to use it in your code.
For Example you can see my [master](https://github.com/QuasarApp/Qt-Secret/blob/master/Qt-Secret.pro) project and incude library [lines](https://github.com/QuasarApp/Qt-Secret/blob/a6828ea53d8b6a5f60def149fee2792ae6d7d774/Qt-Secret-GUI/Qt-Secret-GUI.pro#L22).
@radimkohout if this instruction helped. i Add it to README file. let me know what you got as a result.
It works( You forgot to use "git init")
No. I am use "git submodule update --init --recursive" this command initializes along with a full upgrade.
can i close the topic?
Nope, when I use QRSAEncryption e(QRSAEncryption::Rsa::RSA_2048); 13:36:24: The program has unexpectedly finished. 13:36:24: The process was ended forcefully. (in main.h, qrsaencryption.h is included, when I comment this, it works. It is example from readme)
@radimkohout Yes. This is not a valid example. I updated README. See a new example :
#include <qrsaencryption.h>
#include <QDebug>
bool testEncryptAndDecryptExample() {
QByteArray pub, priv;
QRSAEncryption e(QRSAEncryption::Rsa::RSA_2048);
e.generatePairKey(pub, priv); // or other rsa size
QByteArray msg = "test message";
auto encryptMessage = e.encode(msg, pub);
if (encryptMessage == msg)
return false;
auto decodeMessage = e.decode(encryptMessage, priv);
return decodeMessage == msg;
}
int main() {
if (testEncryptAndDecryptExample()) {
qInfo() << "Success!";
}
}
Not better. This is my code: `
bool testEncryptAndDecryptExample() {
QByteArray pub, priv;
QRSAEncryption e(QRSAEncryption::Rsa::RSA_2048);
e.generatePairKey(pub, priv); // or other rsa size
QByteArray msg = "test message";
auto encryptMessage = e.encode(msg, pub);
if (encryptMessage == msg)
return false;
auto decodeMessage = e.decode(encryptMessage, priv);
return decodeMessage == msg;
} int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); MyServer S; if (testEncryptAndDecryptExample()) { qInfo() << "Success!"; } return a.exec(); } ` The only thing I am getting are 37 warnings like this: Makefile.GMP:80: warning: ignoring old recipe for target 'sub-tests-tests-pro-qmake_all'
Show me your build log or give me your repository with your code. So that I can find a problem.
Sorry, I made some mistakes when writing the instructions, it’s important for us to build the dependencies first and then only your project. I updated the instructions. You need to rewrite your Master.pro with instructions
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
youProjectFolder
youProjectFolder.file = path/to/yuorProject.pro
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \ Qt-Secret \ youProjectFolder \
youProjectFolder.file = path/to/yuorProject.pro
* Open YouProject.pro
* Include in your MyProject.pro file the pri file of Qt-Secret library (insert ito end of file next line :)
``` qmake
include($$PWD/../Qt-Secret/src/Qt-Secret.pri)
For Example you can see my master project and incude library lines.
just add
TEMPLATE = subdirs
CONFIG += ordered
and swap Qt-Secret and YourProjectFolder. So that Qt-Secret would be the first.
Fixed... See my repo. But I am getting another error:
error: [Makefile:133: sub-youProjectFolder-file-make_first-ordered] Error 2
you forgot about CONFIG + = ordered in master.pro
TEMPLATE = subdirs
CONFIG += ordered
Nope, it was one-time compilation error. Rebuild, and it works. Thanks. Everything's working.
@radimkohout it is still extremely important for you to add 'CONFIG + = ordered' because this configuration forces qmake to build the projects in the order you specify. If this setting does not exist, then you will now receive periodically compilation errors.
I have It there.
Hi, how can I use this library in qt creator on windows? I can't do it. Thanks Radim Kohout