小编Nev*_*ain的帖子

138
推荐指数
4
解决办法
21万
查看次数

字符串尚未声明,QT

我正在尝试更改某个文本框消息.它会显示我的输出.

这是我在main()中的内容

#include "form2.h"
....
string recvMSG = "random";
Run Code Online (Sandbox Code Playgroud)

182 :: Form2 :: changeOutput(recvMSG); ...

在我的form2.h中,我有:

#include <string.h>    
#include <iostream>
#include <stdlib.h>    
...
    void Form2::changeOutput(string s)
    {
    QString s1 = i18n(s);
    output_box.setText(s1);

    }
Run Code Online (Sandbox Code Playgroud)

但我仍然得到:.ui/form2.h:56:错误:'string'尚未声明

谢谢.

编辑:: kk所以现在它显示:: TCPClient.cpp:182:错误:无法调用成员函数'virtual void Form2 :: changeOutput(std :: string)'没有对象

c++ qt

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×2

qt ×2

qstring ×1

string ×1