Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#7 Add support for Visual Studio 2010

David Hoerl

New sln-files and project files are need. Besides, Visual Studio 2010 already contains u16string in xstring file (conflict).


1 2 > >> (Page 1 of 2)
  • The u16string issue can be solved by changing every occurrence of u16string to std::u16string. Not pretty I know.
    Another issue: The include paths get broken after importing the MSVS2008 sln file in MSVS2010. Changing the paths in the files works, but is dirty.
    On top of that there appears to be a project missing: the createDLL
    The path to it in the 2008 sln refers to a project somewhere outside the xlslib folder: "..\..\..\OpenEXR\IlmBase\vc\vc9\IlmBase\createDLL\createDLL.vcproj".
    Create DLL sounds kinda important.^^
    Is the creator of the 2008 sln file still around and could add this project to the svn if it is necessary?

  • Further investigation revealed that the createDLL project is responsible for creating the actual DLL file, who'd guessed?
    At least that is what I gather from the "xlslib_dll.vcproj" file. It explains why MSVS2010 gives me this error when I try to build "xlslib_dll": LINK : fatal error LNK1181: cannot open input file %SOMEPATH%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug\xlslib_dll.lib'

    At least I managed to build "xlslib_lib". I'll check later whether I can use the lib in another solution or not.

    line from "xlslib_dll.vcproj":
    echo $(SolutionDir)bin\Win32_MSVC2008.$(ConfigurationName)\createDLL -M$(PlatformName) -n$(OutDir)\$(ProjectName).map -l$(IntDir) -i$(OutDir)\$(ProjectName).lib
$(SolutionDir)bin\Win32_MSVC2008.$(ConfigurationName)\createDLL -M$(PlatformName) -n$(OutDir)\$(ProjectName).map -l$(IntDir) -i$(OutDir)\$(ProjectName).lib

if not exist "$(SolutionDir)bin\$(PlatformName)_MSVC2008.$(ConfigurationName)" mkdir "$(SolutionDir)bin\$(PlatformName)_MSVC2008.$(ConfigurationName)"
copy "$(TargetPath)" "$(SolutionDir)bin\$(PlatformName)_MSVC2008.$(ConfigurationName)\$(TargetFileName)

  • David Hoerl
    David Hoerl

    I'm a bit unsure of what you want relative the the u16string. I'm willing to change those to xlslib::u16string - which is what I think you are asking for (as MS has added u16string to std ??). Pls clarify.

    Unfortunately the person who did the MS project work fell ill and no longer assists with this project (Ger). I'm an Apple guy with no experience in MS at all, so nothing I can do to help with the project file issue(s).

  • David Hoerl
    David Hoerl

    • assigned_to: nobody --> dhoerl
    • status: open --> open-accepted
  • @u16string: I changed every "u16string" to "std::u16string" in the files. It will compile then at least. I couldn't test wheter it works afterwards or not. I will report back here when I know wheter it works or not.

    @createDLL: I just checked out the SVN. CreateDLL is there, although not in the correct path for visual studio. I'll see if I can fix up the project file for 2010 later.

  • arietto

    typedef basic_string<char16_t, char_traits<char16_t>,
    allocator<char16_t> > u16string;
    Please, visit this page:

  • arietto

    • status: open-accepted --> open
  • Good point, shouldn't use "std::u16string". But using "xlslib::u16string" doesn't work as it is not a namespace. If you could move u16string to that namespace or anyone at all, it would be great.

  • Another solution would be to rename u16string in "xlstypes.h".

    typedef std::basic_string<unsigned16_t> u16string;


    typedef std::basic_string<unsigned16_t> _u16string;

    Of couse this involves a substitution of all "u16string" with "_u16string".
    This solves the ambiguity problem in MSMS2010 while keeping the code cross platform.
    Although the massive renaming is not elegant, but this solution is simple and works.

    Now the problems with createDLL and the include paths have to be solved. I'm on it.

  • I figured out how to solve the include path issue:

    For the projects xlslib_dll & xlslib_lib you have to "..\..\src" to their respective
    "Project Properties->Configuration Properties->VC ++ Directories->Include Directories"

    This leaves the createDLL problem. If I solve that I will upload the files for MSVS2010.

  • David Hoerl
    David Hoerl

    Regarding u16string; can't I just undefined it for MSVC2010? Or just not define it in that case? Can you give me a #if statement that would do this?

  • arietto

    In Visual Studio 2010, _MSC_VER is defined as 1600
    #ifndef _MSC_VER
    // not VC++
    #elif _MSC_VER < 1400
    // older than VC++ 2005
    #elif _MSC_VER < 1500
    // VC++ 2005
    #elif _MSC_VER < 1600
    // VC++ 2008
    #elif _MSC_VER < 1700
    // VC++ 2010
    // Future versions

  • David Hoerl
    David Hoerl

    Right, I understand. But I'm not the guy to code this - I have no MSVC setup to test it. You send me the proper way to code the test and I'll add it to the source. Its already special cased for Microsoft if I recall (don't have the code handy).

  • I came up with a macro that apparently solves the u16string issue. Apparently, because there is one other issue preventing me from generating the dll.

    For the macro, old version in common/xlstypes.h:

    #if defined(__cplusplus) // ALL C++ users

    #if defined(_MSC_VER) && defined(WIN32) // Windows

    typedef wchar_t unichar_t;
    #define ustring wstring
    //typedef wstring ustring;
    typedef std::basic_string<unsigned16_t> u16string;

    #elif defined(__FRAMEWORK__) // MAC Framework

    New version:

    #if defined(__cplusplus) // ALL C++ users

    #if defined(_MSC_VER) && defined(WIN32) // Windows

    typedef wchar_t unichar_t;
    #define ustring wstring
    //typedef wstring ustring;

    // every Visual Studio version before 2010 needs this, as 2010 introduced its own version of u16string
    #if _MSC_VER < 1600
    typedef std::basic_string<unsigned16_t> u16string;
    using std::u16string;

    #elif defined(__FRAMEWORK__) // MAC Framework


    This makes MSV2010 and later use its own u16string instead of std::basic_string<unsigned16_t>.
    Not defining u16string for MSVS2010 doesn't work, although I'm not certain why.
    I would have prefered to use std::basic_string<unsigned16_t> instead of std::u16string so that all versions of xlslib use the same class.


    The issue of the missing createDLL project/tool can be solved by placing the OpenEXR folder in the same folder als the xlslib folder, like in the svn.
    In other words, please include the OpenEXR folder in the archives that will be released, as OpenEXR is needed. Even the MSVS2008 files need that folder.
    After that I had to replace "..\..\..\installCreateDLL.cmd" with "..\..\..\..\..\installCreateDLL.cmd" in the "createDLL.vcxproj" & "createDLL.vcproj" files in OpenEXR to make it work.
    Arietto, can you confirm this? The original settings of OpenEXR should have been fine, but for some reason they weren't for me.


    What I have done so far:

    1. Opened and updated "build\msvc2008\xlslib.sln" with MSVS2010.
    2. Used the above macro to solve the u16string ambiguity.
    3. Solved the include path problem by adding "..\..\src" to "Project Properties->Configuration Properties->VC ++ Directories->Include Directories" for the every project except createDLL.
    4. Copied the OpenEXR folder from the SVN trunk into the same folder as my working copy of the xlslib folder. Reopend the solution with MSVS2010.
    5. Had the VS10 solution file (build\msvc2008\xlslib.sln) point to "vc10\IlmBase\createDLL\createDLL.vcxproj" for the createDLL tool, not "vc9\IlmBase\createDLL\createDLL.vcxproj".
    6. Replaced "..\..\..\installCreateDLL.cmd" with "..\..\..\..\..\installCreateDLL.cmd" in all "createDLL.vcxproj" & "createDLL.vcproj" files in OpenEXR folder.
    7. Rebuild createDLL with MSVS2010.

    Now I am able to build the project xlslib_lib, but the project xlslib_dll fails after all source files are processed with the error:
    LINK : fatal error LNK1181: cannot open input file 'C:\%myworkingfolder%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug\xlslib_dll.lib'

    There is no xlslib_dll.lib of course, just two copies of xlslib_lib.lib in two different folders (it got copied by a post build event).
    The first folder is the source folder, the second the destination one:

    Copying xlslib_lib.lib to C:\%myworkingfolder%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug
    and renaming it to xlslib_dll.lib, doesn't work either.
    c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(3051,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "GetCopyToOutputDirectoryItems".
    Nevertheless a xlslib_dll.dll is generated. I couldn't get that one to work though.

    As I can't figure out more than that xlslib_dll.lib is not generated but needed, Arietto, can you give this a shoot? You appear to know more about MSVS than I do.

  • arietto

    Hello, Mr. hiredicespecter!
    So, where are you stuck?

  • I can't compile the dll project. although I am able to build the project xlslib_lib,

    The dll project fails after all source files are processed with the error:
    LINK : fatal error LNK1181: cannot open input file

    Everything I fixed so far is listed in my previous comment.

    I would ask you to reproduce what I did, confirm these steps behave for you as they did for me and try to figure out the error message of the dll project.

    I know it's quite a lot.

  • arietto

    Well, at least we should test solution 2008 for the 1st time.
    I've tried to build solution in Visual Studio 2008.
    I've got plenty of errors:
    Error 9 fatal error C1083: Cannot open include file: 'xlslib/record.h': No such file or directory d:\aries\xlslib-2.3.4\xlslib\src\xlslib\summinfo.cpp 33

  • arietto

    I think that VS solutions must be more well tested in comparison to RadStudio, CodeBlocks and BDS projects for Windows. Visual Studio is a mainstream C++ IDE for Windows and the lack of high-quality solutions which work out of the box does not allow to work with xlslib in a comfortable way.

  • I managed to correct the settings for Visual Studio 2008. It created a dll.

    The steps are the same as for 2010, but some settings have slightly different names.

    Sorry for my late reply, work is keeping me busy.

  • Following are the detailed steps I took to generate the dll with Visual Studio 2008. Can you confirm those, Arietto? Aka follow them and see if you can make the 2008 solution work on your end, too?
    @David: Could you add the folder OpenEXR to all following releases of xlslib, as it is essential for VS 2008 and 2010?

    What I did you make VS 2008 to build a DLL:
    1. Opened "build\msvc2008\xlslib.sln" with MSVS2008.
    2. Unloaded (right-click) and reloaded every project. Otherwise VS will show an error message when trying to access the properties of a project. This is only needed once.
    3. Solved the include path problem by adding "..\..\src" to "Project
    Properties->Configuration Properties->C/C++->Additional Include Directories" for the every project EXCEPT createDLL.
    4. Copied the OpenEXR folder from the SVN trunk into the same folder as my
    working copy of the xlslib folder. Reopend the solution with MSVS2008.
    6. Replaced "..\..\..\installCreateDLL.cmd" with
    "echo ..\..\..\installCreateDLL.cmd" in “createDLL-Properties -> Configuration Properties -> Build Events -> Post Build Event->Command Line”.
    7. Rebuild createDLL , rebuild xlslib_lin, rebuild xls_libdll and a xlslib_dll.dll is built. Haven’t tested the dll though.

  • David Hoerl
    David Hoerl

    I'll be glad to add the folder, just want to be 100% sure of WHERE you want it to be. I believe you want it in the top-level xlslib directory..correct?


  • Not in the top-level xlslib directory. Next to the xlslib top-level directory, like it is in the SVN directory trunk.

    Like this (think directory tree):


  • Argh, the white space got removed.

    Well, got to use a bunch of sentences:

    OpenEXR is a subdirectory of xlslib.zip.
    xlslib is a subdirectory of xlslib.zip.
    build, config, etc are subdirectories of xlslib.

    Sounds stupid, but should clarify what I mean. ;-)

  • I figured out which files have to been updated for Visual Studio 2008:


    I placed fixed versions in a zip file. How do I get that to you or on sourceforge?

  • arietto

    hiredicespecter, do have you asked me?
    If so, then please send it to my email
    lutaries (at) rambler (dot) ru

1 2 > >> (Page 1 of 2)