Problem Description:
Problem Description: a new QT GUI project is created without any modification, but the error list shows that the existing file cannot be opened, and there are various red underscores under the header file of the file code, but it can be run directly main.cpp no problem.
terms of settlement:
For the existing files in the project that cannot be opened, it means that the path of the current project is not included. Here, you can refer to the acquisition method of C + + header file reference (c + + knowledge focus). So we just need to add in the current project path.
Methods: right click the project, click properties, select the included directory in VC + + directory, add $(projectdir)
, then apply and confirm.
principle
#Include & lt; XX. H & gt; means to search for files directly from the function library of the compiler, and the compiler starts to search for. Xxh from the standard library path
#Include “XX. H” means to search from the user-defined file first. If not, search from the function library. The compiler starts to search XX. H from the user’s working path
If we refer to the header file written by ourselves in the way of & lt; & gt;, we will inevitably be unable to find the source file, because our file is placed in the user directory. The above solution is essentially to append the user directory to the compiler search scope. In fact, we can solve the problem by replacing & lt; & gt; with “” instead.
Read More:
- How to solve the problem of “unable to open source file XXXXX. H” in VS development?
- Solution of vs unable to open source file and link library file
- Solution of unable to open source file “StdAfx. H” in vs2013 / 2012
- Vs compiling OpenGL project, the solution of unable to open the source file “GL / glaux. H” appears
- Unable to open source file in vs
- Vs error prompt: “unable to open source file XXXX. H” possible reasons and Solutions
- Solution to the problem of unable to open glaux. H in vs2013
- Solution of VS2008 unable to open GL / glaux. H header file
- Error in header file when calling OpenGL to open obj file in vs2013: unable to open include file: “GL / glut. H”: no such file or directories
- Vs cannot open source file “XXX. H” problem
- IntelliSense: unable to open source file ‘StdAfx. H’
- IntelliSense in VC + + 2010: unable to open source file “StdAfx. H”
- How to solve the problem of “unable to open include file:” graphics. H “: no such file or directory”
- Vs cannot open the source file unistd. H under Windows
- Vs + QT reports an error “vs cannot open the source file qchartview”
- A fatal error C1083 occurred when compiling C + + code under. Net: unable to open the include file: “xuhk”_ Jnihelloworld. H “: solution to no such file or directory error.
- Vs fatal error C1083: unable to open include file: “sys / socket. H”: no such file
- Vs2019 OpenGL glut: error: unable to open include file: ‘GL / glut. H’: no such file or directory
- Vs2017 cannot open the source file “XXX. H” by adding a file name after creating a new class
- R language-Error in file(out, “wt”): Unable to open the link problem solved