Important: Please read the Qt Code of Conduct -

Building QtXlsxWriter with Visual Studio 2015 and Qt 5.6.1

  • Does anybody succeed in Building QtXlsxWriter with VS2015 and Qt5.6.1 ?
    I downloaded the stuff from GitHub.
    Put it in C:\Qt\QtXlsxWriter.
    Created the folder C: \Qt\QtXlsxWriter-build.
    In this Folder, run qmake ..\QtXlsxWriter

    I got the Makefile.
    I run nmake and I've got fatal Errors.


  • Lifetime Qt Champion


    Did you try to build the original project or the version from @VRonin available here ?

  • Yep. I tried it.
    Same issue.
    Perhaps it's only compatible with MinGW ?

  • Nope, I compile it regularly with MSVC (2013 however). I'll test with 2015 and get back to you

    Your error seems associated with missing cstddef header which is part of the standard. this is weird

  • Do you have any information about the building with VS2015 ?

  • Due to licensing issues my company won't allow me to install MSVC2015 so I'm unable to test. Could someone other than @mulfycrowh try and compile the project in MSVC15 and tell me if they get the same problem please?

  • Ok. No problem. Could you please tell me what you did to compiĺe with VS2013 ?

  • @VRonin Apparently I succeeded in Building the library. I did it in VS2015 while creating a Makefile Project.
    It generated 2 lib files, 2 dll files, 2 exp files ...
    I tried to link my Project with the library and it gives more than 355 LNK Errors.
    Here is the way:
    C/C++ > General > Additional Include Directories : Directory including the headers
    Linker > General > Additional Library Directories : Directory including the lib files
    Linker > Input > Additional Dependencies : I added Qt5Xlsx.lib and Qt5Xlsxd.lib

    Could you help please

  • could you try via console?

    • Download the souce code (git clone or zip download and unpack) in a folder (let's call it C:\QtXlsx )
    • open the VS developer console (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\Shortcuts\VS2015 x86 Native Tools Command Prompt.lnk or something similar)
    • go in the folder where you downladed the source: cd C:\QtXlsx
    • set up the qt environment: C:\Qt\5.7\msvc2015\bin\qtenv2.bat
    • run qmake to prepare the makefiles: qmake
    • run make to build the libarary: nmake
    • run make install to install it as a module: nmake install

    Now you should be able to use it as a qt module, in your pro file just add the lineQt += xlsx and it should work out of the box

  • Sorry. It doesn't run.
    QtSCore.lib(QtSCore.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

    I also have the error in a x64 native Tools command prompt

  • @VRonin I think it would be great to compile QtXlsxWriter for 64 bits. My Project is 64 bits.

  • Lifetime Qt Champion

    Because you likely started the command line for 32bit compilation. Selection the 64 bit development command line.

  • @SGaist Thanks for Reply. Yes for sure. How can I select 64 bits.
    I run qmake then nmake

  • Lifetime Qt Champion

    One way is described here

  • @SGaist Thanks. I take a look

  • @mulfycrowh

    How can I select 64 bits.

    Instead of C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\Shortcuts\VS2015 x86 Native Tools Command Prompt select C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\Shortcuts\VS2015 x64 Native Tools Command Prompt

  • Everything runs perfectly. I would like to thank everyone for the help !
    I wrote a guide for the building of the library in 64 bits and VS2015.
    Here is the guide:

    FOR 64 BITS

    1- Download the QtXlsxWriter zip file from gitHub:
    2- Unzip in C:\QtXlsx
    3- Open the VS2015 x64 Native Tools Command Prompt
    4- Type cd
    5- Type cd Program Files (x86)\Microsoft Visual Studio 14.0\VC
    6- Type vcvarsall amd64
    7- Type cd
    8- To set up the Qt environment, type cd Qt\Qt5.6.1\5.6\msvc2015_64\bin and then qtenv2
    9- Type cd
    10- Type cd QtXlsx
    11- Type qmake
    12- Type nmake

    DONE !


    a- Goto C/C++ > General and, in Additional Include Directories, add C:\QtXlsx\include\QtXlsx
    b- Goto Linker > General and, in Additional Library Directories, add C:\QtXlsx\lib
    c- Goto Linker > Input. In Additional Dependencies, you had : <different options>.
    Add Qt5Xlsxd.lib and Qt5Xlsx.lib to get Qt5Xlsxd.lib;Qt5Xlsx.lib;<different options>
    d- You have to add Qt5Xlsxd.dll and Qt5Xlsx.dll to the executable folder (depending on the configuration)

    DONE !

  • @mulfycrowh said:

    3- Open the VS2015 x64 Native Tools Command Prompt
    6- Type vcvarsall amd64

    They are the same thing so you just need one of the two

    Add Qt5Xlsxd.lib and Qt5Xlsx.lib to get Qt5Xlsxd.lib;Qt5Xlsx.lib;<different options>

    Do not link to both lib, use the Qt5Xlsxd.lib for the debug config and Qt5Xlsx.lib for release

Log in to reply