编译出错:redefinition of ...previous definition of ..

weixin_38052782 2019-09-19 01:15:38
Userinfo.h:5: redefinition of `class Userinfo'Userinfo.h:5: previous definition of `class Userinfo'Userinfo.h:5: confused by earlier errors, bailing out在定义一个类Userinfo时出现了以上错误#include <QtCore>#include <QtNetwork>class Userinfo{  Q_OBJECT    private:     QString *username;    QString *password;    QHostAddress *serverIP;    int port;    QTcpSocket *tcpSocket;    public:    Userinfo(QString * username=0, QString * pwd=0, QHostAddress * serverIP=0, int port=0, QTcpSocket *tcpSocket=0);      void getUsername(const QString * username);    void getPassword(const QString * pwd);    void getServerIP(const QHostAddress * serverIP);        void getPort(int port);        void getTcpSocket(const QTcpSocket * tcpSocket);    }; 请高手指教,谢谢!
...全文
2754 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38063515 2019-09-19
  • 打赏
  • 举报
回复
C/C++ 基本问题,头文件重复包含了最好给你的头文件加保护符#ifndef xxxx#define xxxx....#endif
weixin_38067396 2019-09-19
  • 打赏
  • 举报
回复
有没有可能会是跟库中的接口有冲突,毕竟你不是重载
weixin_38091234 2019-09-19
  • 打赏
  • 举报
回复
谢谢指教!!!,问题解决了
weixin_38095649 2019-09-19
  • 打赏
  • 举报
回复
很可能是头文件重复包含。

474

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧