Vs2019 + QT parses the XML file and reports an error at doc.setcontent
Made a very low-level mistake. Record the process.
A QT project was established long ago. Now to add a function of parsing XML files using the qdom class, there is always an error in the sentence doc.setcontent (& amp; file)
, and there is no error message. The relevant C + + codes are as follows:
QString error;
int line, column;
if (doc.setContent(&file, &error, &line, &column)) {
qDebug() << doc.toString(4);
}
else {
qDebug() << "Error:" << error << "in line " << line << "column" << column;
}
file.close();
When doc.setcontent (& amp; file, & amp; error, & amp; line, & amp; column)
, critical error detected c00000374 is displayed
The first reaction is that the XML file is incorrectly written. For example, there is no space in the space, Chinese punctuation is entered, or the two sides of the tag are inconsistent
after repeatedly confirming that the XML file is correct, the stackoverflow search said that the relative path cannot be used, but the absolute path must be used… Another attempt of the absolute path is useless.
Create a new project and run it with the same code without error. Through careful comparison, it is found that in the new project, I added the XML class library
but not in the original project!
So far, add $(qtdir) \ include \ qtxml
in the C/C + + include directory, add qt5xmld.lib
[debug mode] and qt5xml. Lib
[release mode] in the linker, and the operation is successful!
Finally, I found that if the XML file is written incorrectly, the above program can locate the error location. Direct reporting of fatal error/critical error
or unresolved external symbols like this__ declspec(dllimport) public: __ Cdecl
, the probability is that the Lib file link is wrong rather than the code problem. You need to check whether the environment is configured correctly.
A simple question has been wordy for a long time… Mainly to warn yourself that you must think more and think more about ways to expose the problem when you encounter a problem that has no solution on the Internet!
Read More:
- Vs + QT reports an error “vs cannot open the source file qchartview”
- QT + MySQL generates an EXE file and reports an error “driver not loaded”. Solution steps
- The file server reports an error of 413, and the file uploaded by nginx reports an error of 413 request entity too large
- XML file should have root tag (extra content at the end of the document in file error)
- Vue introduction path is correct, but it always reports an error: already included file name‘ ××ב differs from file name ‘ ××ב only in casing.
- Vs QT project ‘fatal error C1083:’ failed to open include file
- VS2010 compiler can’t open include file: “GL / glaux. H”: no such file or directory
- 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
- In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory
- [ ERROR ] Error loading xmlfile: squeezenet1.1\FP16\squeezenet1.1.xml, File was not found at line: 1
- Win10 vs 2017 prompt cannot open include file: “windows. H”: no such file or director
- Golong based tool for automatically generating the corresponding struct file according to XML file
- When Jenkins deploys the project, GIT reports an error fatal: index file smaller than expected
- VS 2010: An error occurred loading a configuration file: Failed to map the path ‘/’.
- Error in reading XML file IOException parsing XML document from URL
- Solution of vs unable to open source file and link library file
- Unit Android converts c# class to JSON file and reports an error
- Error parsing Mapper XML. The XML location is ‘file
- Vs2017 cannot open the source file “XXX. H” by adding a file name after creating a new class
- Vs fatal error C1083: unable to open include file: “sys / socket. H”: no such file