我正在使用(HashLib ++)创建文件的哈希应用程序 但是当我用Qt Creator测试(Library)时,给我一个错误 这是错误的图片 $屏幕快照148.png-Google云端硬盘 [ ^ ] 老实说,我不知道是什么导致此错误 我尝试了很多事情但没有运气 我尝试过的事情: 我尝试了很多解决方案,但没有运气
i''m making a file''s hashing app using a (HashLib++) but when i test the (Library) with the Qt Creator it gives me an error here is the pic of the errors $Screenshot 148.png - Google Drive[^] honestly i don''t know what''s make this error i tried many things but no luck What I have tried: i tried a lot of solutions but no luck
推荐答案屏幕截图148.png-Google云端硬盘 [ ^ ] 老实说,我不知道是什么导致此错误 我尝试了很多事情但没有运气 我尝试过的事情: 我尝试了很多解决方案,但没有运气 Screenshot 148.png - Google Drive[^] honestly i don''t know what''s make this error i tried many things but no luck What I have tried: i tried a lot of solutions but no luck
请不要发布指向图像的外部链接.您只有几行代码和一条错误消息可以在此处发布. 如果您这样做了,我将能够将代码复制并粘贴到我的答案中,向您展示如何解决该问题.但是,这样您只会得到一个文本答案. 错误消息很清楚,并且有一个小箭头指示传递的参数file02是罪魁祸首.以下几行告诉您,有一个候选人(我必须输入才能知道!): Please don''t post external links to images. You only have a few lines of code and an error message that can be posted here. If you had done that I would be able to copy and paste the code into my answer showing you how to solve the problem. But so you will only get a textual answer. The error message is quite clear and a small arrow indicates that the passed argument file02 is the culprit. The following lines tell you that there is a candidate (I have to type it know!): virtual std::string hashwrapper::getHashFromFile(std::string)
您正在传递类型为QFile的file02,但是函数getHashFromFile期望为std::string. 假设参数是文件名,则可以从中创建std::string后使用file01,其类型为QString:
You are passing file02 which is of type QFile but the the function getHashFromFile expects a std::string. Assuming that the parameter is a file name, you can use file01 which is of type QString after creating a std::string from that:
QString Z_01 = file_hashing->getHashFromFile(file01.toStdString());我错过了将结果分配给QString的情况.所以应该是:
I missed that the result is assigned to a QString. So it should be:
QString Z_01 = QString::fromStdString(file_hashing->getHashFromFile(file01.toStdString()));[/EDIT] 回答提出的新问题作为解决方案:
[/EDIT] Answering a new question raised as solution:
mainwindow.o:-1: In function `__static_initialization_and_destruction_0': error: undefined reference to `md5wrapper::md5wrapper()' error: collect2: error: ld returned 1 exit status您必须链接到包含md5wrapper的库. 为此,将库添加到Qt项目文件中的LIBS配置中.另请参见向项目中添加库| Qt创建者手册 [ ^ ].
You must link with library containing md5wrapper. To do this add the library to the the LIBS configuration in your Qt project file. See also Adding Libraries to Projects | Qt Creator Manual[^].
更多推荐
在Qt项目中使用(hashlip ++)时出现问题
发布评论