Qt编译问题-向导生成的helloworld都编译出错

今天在公司的电脑上使用Qt5.8.0的时候碰到了一个很奇怪的问题,我新创建一个简单的helloworld工程时,编译直接出错。编译报错如下:

D:\Qt\qt_example\build-untitled2-Desktop_Qt_5_8_0_MinGW_32bit-Debug\debug\mainwindow.o:-1: In function `ZN10MainWindowC2EP7QWidget':

D:\Qt\qt_example\untitled2\mainwindow.cpp:6: error: undefined reference to `vtable for MainWindow'

D:\Qt\qt_example\untitled2\mainwindow.cpp:6: error: undefined reference to `vtable for MainWindow'

D:\Qt\qt_example\build-untitled2-Desktop_Qt_5_8_0_MinGW_32bit-Debug\debug\mainwindow.o:-1: In function `ZN10MainWindowD2Ev':

D:\Qt\qt_example\untitled2\mainwindow.cpp:11: error: undefined reference to `vtable for MainWindow'

D:\Qt\qt_example\untitled2\mainwindow.cpp:11: error: undefined reference to `vtable for MainWindow'

collect2.exe:-1: error: error: ld returned 1 exit status

关于这些问题我百度过,Google过,都没效果。

其实这个我是直接通过向导来生成的,运行起来应该是正常的才对。不过我试过了很多遍都还是报错。而我打开例程来运行却正常。

后来我使用自己的笔记本来使用Qt5.8.0来通过向导来新建工程时,也是正常的。后来一想到以前遇到的vs2015也无法编译的问题当时vs2015也是一样的情况,一创建工程来运行就报错,或者一修改程序后再运行也报错,直接打开网上下载的或其他电脑上拷贝过来的正常程序来运行却是正常的。。

其实,这个问题主要是公司的电脑上安装了亿赛通文档加密系统的原因。因为公司为了保护公司资料而购买的文档加密系统的问题。

后来让管理员添加这个Qt的策略后,然后我这边更新策略,就搞定了。




猜你喜欢

转载自blog.csdn.net/caokunchao/article/details/75090043
今日推荐