QXlsx icon indicating copy to clipboard operation
QXlsx copied to clipboard

Failed to compile - “private/qzipwriter_p.h”: No such file or directory

Open KelvinYJY opened this issue 6 years ago • 8 comments

When I compile QXlsx\source\xlsxzipwriter.cpp in vs2013 and qt 5.9.1, error is throwed : “private/qzipwriter_p.h”: No such file or directory . I have found this in Qt5.9.1\5.9.1\msvc2013_64\include\QtGui\5.9.1\QtGui\private, and finally I compile successfully after adding these include path: Qt\Qt5.9.1\5.9.1\msvc2013_64\include\QtCore\5.9.1, C:\Qt\Qt5.9.1\5.9.1\msvc2013_64\include\QtGui\5.9.1, C:\Qt\Qt5.9.1\5.9.1\msvc2013_64\include\QtGui\5.9.1\QtGui\

KelvinYJY avatar Oct 31 '19 10:10 KelvinYJY

Try to use vs2017. https://github.com/QtExcel/QXlsx/blob/master/TestEnv.md

j2doll avatar Oct 31 '19 11:10 j2doll

@KelvinYJY The thing is that the developer has used vs2017 and latest Qt for building it. If you want to use the same thing, then use the same msvc and qt version. Other option as you mentioned is the provide private folder paths in the include section.

mehtajinesh avatar Nov 19 '19 14:11 mehtajinesh

This may be related to issue 64 (CMake support).

I tried to build the library with Cmake but I ran into trouble with the use of private headers as well. As far as I understand it, Qmake (not Cmake) can use them by including something like: QT += gui-private Only Cmake has no such option. By forcing some fixed paths in the Qxlsx library and Qt5 code itself I can get a little further, but this results in linker errors later.

Is there a way to NOT use Qt private libraries?

I will include my (failed) attempt with Cmake here as example. Qxlsx-lib.zip This was build on Windows 10, using MinGW-32, Qt5.14.x, Cmake and Ninja. I used VS Code as IDE.

tlouwers avatar Feb 13 '20 13:02 tlouwers

Dear @tlouwers

Private classes is used for zip library(or something).

If your project is based on cmake, I recommend using xlnt.

j2doll avatar Feb 13 '20 23:02 j2doll

@j2doll @tlouwers

I also faced this issue under Qt MSVC2017 + Cmake + VS2019, I noticed that its caused by the "Qt Visual Studio Tools" Plugin. If we open the QXlsx.pro file using Qt VS Tools, it will auto generate QXlsx.vcxproj file. but the option "gui-private" is incroectlly replaced with "gui", so we got this build error.

So we have to manual open the QXlsx.vcxproj file and replace "gui" to "gui-private", then you can be build successfully. Just for your reference.

Regards, Wen

keven2116 avatar Apr 07 '20 13:04 keven2116

The QZipWriter is private class in private/qzipwriter_p.h . Don't use it. Suggest to reimplement QZipWriter in the project.

KangLin avatar Sep 02 '20 02:09 KangLin

I only use gcc and QtCreator. If anyone knows VS+Qt well, please answer or pull-request.

j2doll avatar Sep 05 '20 09:09 j2doll

Solved on Debian by install qt6-base-private-dev

romanlubimov avatar Apr 18 '24 07:04 romanlubimov