gpt4 book ai didi

c++ - 为什么 Qt 不能识别我的头文件?无法打开包含文件 没有这样的文件或目录

转载 作者:IT老高 更新时间:2023-10-28 22:35:24 25 4
gpt4 key购买 nike

我的 .pro 文件中有以下内容,并且我有 #include "headerhere"的文件。 例如:#include "StdAfx.h"。但是我得到了一个

error Cannot open include file: 'StdAfx.h': No such file or directory.

无论我使用 #include "StdAfx.h" 还是 #include "Shared/StdAfx.h",我都会遇到相同的错误。这非常令人沮丧,除非 Qt 开始识别我的标题,否则我无法做任何实际工作。我在网上发现没有解决方案。怎么回事?

.pro 文件有:

HEADERS  += ibproject.h \
Shared/StdAfx.h \
Shared/TwsSocketClientErrors.h \
Shared/TagValue.h \
Shared/shared_ptr.h \
Shared/ScannerSubscription.h \
Shared/OrderState.h \
Shared/Order.h \
Shared/IBString.h \
Shared/HScrollListBox.h \
Shared/Execution.h \
Shared/EWrapper.h \
Shared/EClientSocketBaseImpl.h \
Shared/EClientSocketBase.h \
Shared/EClient.h \
Shared/Contract.h \
Shared/CommonDefs.h \
Shared/CommissionReport.h \
SocketClient/src/EClientSocket.h
ewrappersubclass.h

INCLUDEPATH += $$PWD/SocketClient
DEPENDPATH += $$PWD/SocketClient

编辑:为什么我会被否决?这是我遇到的合法问题

Image showing it recognizes and doesn't recognize simultaneously

最佳答案

我也遇到了同样的问题。原因是我并行使用两台计算机,makefile 试图在路径中查找文件,因为它们是在前一台计算机上设置的。但一切似乎都很好 - 就像你的情况一样,将鼠标悬停在包含上时的工具提示向我显示了正确的路径,F2(光标下的跟随符号)也将我导航到了正确的标题。

我认为每次更改 .pro 文件中的某些内容时都会重新制作 qmake,但显然不是。

只需运行 Build->qmake,它应该可以修复它。

关于c++ - 为什么 Qt 不能识别我的头文件?无法打开包含文件 没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16257521/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com