具有Crypto ++库的QT控制台应用程序 [英] QT console application with Crypto++ library
问题描述
这真让我发疯.使用crypto ++ 5.6.2版. Mac OSX上的Qt 5.2.1. 所有项目都内置在QT Creator中.我没有从命令行使用make
This is driving me nuts. Using crypto++ ver 5.6.2. Qt 5.2.1 on Mac OSX. All the projects are built inside QT Creator. Im not using make from the command line
我通过解压和构建来构建crypto ++,如下所示:
I build crypto++ by unpacking and building as follow:
- qmake -project
- 删除了GNUmakefile
-
在QT中打开并通过添加修改.pro文件
- qmake -project
- Deleted the GNUmakefile
Open in QT and modified the .pro file by adding
macx {
DEFINES += CRYPTOPP_DISABLE_ASM
}
目标是cryptopp:
The target is cryptopp:
TARGET = cryptopp
设置为发布,运行qmake并进行了全部重建. dylib生成:
Set to release, ran qmake and did a rebuild all. The dylibs get generated:
- libcryptopp.1.0.0.dylib
- libcryptopp.1.0.dylib(别名)
- libcryptopp.1.dylib(别名)
- libcryptopp.dylib(别名)
创建了一个裸控制台应用程序,并包含了我的加密类. 修改了.pro文件,如下所示:
Created a bare console application and included my crypto class. Modified the .pro file as follow:
macx {
# CONFIG += release cryptopp
LIBS += /Users/adviner/Qt5.2.1/5.2.1/clang_64/lib/libcryptopp.1.0.0.dylib
QMAKE_POST_LINK += install_name_tool -change libcryptopp.1.0.0.dylib $$[QT_INSTALL_LIBS]/libcryptopp.1.0.0.dylib $(TARGET)
}
在调试模式下的控制台测试应用中.运行qmake,然后重新构建所有.我不断收到以下错误:
In the console test app in debug mode. Ran qmake and then rebuild all. I keep getting the following error:
:-1: error: symbol(s) not found for architecture x86_64
:-1: error: linker command failed with exit code 1 (use -v to see invocation)
我在qmake的构建步骤中都检查了两个项目,它们都包含x86_64):
I've checked both the projects and they both include x86_64) in the qmake build steps:
cryptopp lib:
qmake /Users/myname/Projects/QTLibs/Source/crypto/cryptopp562/cryptopp562.pro -r -spec macx-clang CONFIG+=x86_64
测试控制台应用程序:
qmake /Users/myname/Projects/Test/CryptoTest/CryptoTest.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=declarative_debug CONFIG+=qml_debug
我已经做了一些Google搜索,但似乎没有任何答案可以解决我的问题.有任何想法吗?我已经使用Qt 5.2.1在Windows上构建了相同的crypto ++ lib,并在我的应用程序中使用了它,没有任何问题.
Ive done some google search but nothing seems to answer my problem. Any ideas? I have built the same crypto++ lib on windows using Qt 5.2.1 and used in my app with no problems.
推荐答案
好,我终于明白了.当我在Mac上构建crypto ++ lib时,我如上所述进行了添加:
OK i finally figured it out. When I built the crypto++ lib on the Mac I added as described above:
macx {
DEFINES += CRYPTOPP_DISABLE_ASM
}
在控制台应用程序上,我还必须将其添加到.pro文件中,并且现在可以正常使用
Well on the console application I had to also add this in the .pro file and it works now
我发现以下提示也可以修改
I found the following tip also to modify
/Users/adviner/Qt5.2.1/5.2.1/clang_64/mkspecs/macx-clang/qmake.conf
/Users/adviner/Qt5.2.1/5.2.1/clang_64/mkspecs/macx-clang/qmake.conf
来自 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
From QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
至 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
To QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
但是它对我没有任何帮助.
But it didnt do anything for me.
唯一的解决方案是同时放在lib上并测试CRYPTOPP_DISABLE_ASM
Only solution was to put on both lib and test the CRYPTOPP_DISABLE_ASM
这篇关于具有Crypto ++库的QT控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!