brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
425 stars 113 forks source link

how to use with visual studio #8

Closed JasonMrX closed 8 years ago

JasonMrX commented 8 years ago

Hi,

I am new to C/C++ and I am using visual studio. I find your project very cool, but I have no clue of how to include this library into my project. I was wondering if I could have some step by step guidance. Any links to external learning resource would also be appreciated!

Many thanks,

Jason

brechtsanders commented 8 years ago

Hi,

I don't use Visual Studio myself, but I know that people are using this project in Visual Studio.

Basically you should search on Internet how to use CMake to build a library from source for Visual Studio. You will also need to build the dependancies (libzip and expat). Once you have the library you need to link with it in your own Visual Studio project.

But you could also just try using the binary files and link with the .a library files, see this link for more information: http://stackoverflow.com/questions/2096519/from-mingw-static-library-a-to-visual-studio-static-library-lib

Regards

 Brecht

On 25/07/2016 23:46, Jiasen (Jason) Xu wrote:

Hi,

I am new to C/C++ and I am using visual studio. I find your project very cool, but I have no clue of how to include this library into my project. I was wondering if I could have some step by step guidance. Any links to external learning resource would also be appreciated!

Many thanks,

Jason

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brechtsanders/xlsxio/issues/8, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ0-ebzUP_0SMcLdGnWnuoReTi3Dieifks5qZS64gaJpZM4JUlNX.

JasonMrX commented 8 years ago

Thanks, Brecht. It really helps a lot. Very much appreciated.

fengcai commented 5 years ago

hi, Jason

have you succeeded in VC? I try to use CMake against Visual C++ and come across the error while configure

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find Minizip (missing: MINIZIP_LIBRARIES MINIZIP_INCLUDE_DIRS) Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) CMake/FindMinizip.cmake:18 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:38 (FIND_PACKAGE)

I have downloaded miniZip and expat-2.2.6 but CMake failed, can you help share your visual c++ project structure?

thanks.

brechtsanders commented 5 years ago

zlib and minizip are not really my projects, so I'm not sure how I can help. Also I'm not a Visual C++ user as I like to stick to open source and cross-platform tools. But, a simple Google search led me to this: https://github.com/madler/zlib/tree/master/contrib/vstudio It explains how to build zlib and minizip for VC 9 to 14.

kekersdev commented 5 years ago

Still getting

Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Minizip (missing: MINIZIP_LIBRARIES MINIZIP_INCLUDE_DIRS)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  CMake/FindMinizip.cmake:18 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:38 (FIND_PACKAGE)
kekersdev commented 5 years ago

After tons of rebuildings of multiple libs i'm stuck on this

Configuring done
WARNING: Target "xlsxio_read_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_STATIC" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_read_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_write_SHARED" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_csv2xlsx" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_csv2xlsx" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_csv2xlsx" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_csv2xlsx" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_xlsx2csv" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_xlsx2csv" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_xlsx2csv" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "xlsxio_xlsx2csv" requests linking to directory "C:/Users/kdpc/Desktop/zlib-master/build/minigzip.dir".  Targets may link only to libraries.  CMake is dropping the item.
Generating done
brechtsanders commented 5 years ago

As described in README.md, you do need the prerequisites (zlib and expat) before building. Those warnings are saying you are linking to a driectory instead of a library file. I have no idea why you are doing that. Note that the -DLIBZIP_DIR:PATH= and -DMINIZIP_DIR:PATH= cmake parameters expect to be the folder where subfolders lib and include can be found with the required files.

kekersdev commented 5 years ago

Fixed that, it now works but generetes no libraries, only VS project files which are not building succesfully

kekersdev commented 5 years ago

In fact i don't need to build this The initial problem was 0xc000007b error when launching my application. As far as i know this error means that x64 application trying to use x86 dll but i definely using the correct one

brechtsanders commented 5 years ago

You definitely can't mix bit depths. Are you sure you built the x64 library? Have you tried using the prebuilt downloads (avoiding the hassle of building all by yourself)?

kekersdev commented 5 years ago

I'm using prebuild downloads Just checked: x86 version works fine

brechtsanders commented 5 years ago

So you are building x64 with the win64 download?

brechtsanders commented 5 years ago

Note that you still need the dependancy libraries too in the same bit-depth (zlib, expat). For example if there is a zlib1.dll in your PATH that is 32-bit while building 64-bit, it may cause this error.

kekersdev commented 5 years ago

Thanks, I'll check that

kekersdev commented 5 years ago

The error still remains

brechtsanders commented 5 years ago

Is your problem with 64-bit only / did you have success with 32-bit? Again, I'm not an MSVC expert. Make sure to figure out how to build for win32 and win64 respectively with CMake and MSVC... Personally I use MinGW-w64 on Windows and have no problems.

kekersdev commented 5 years ago

Ended up using precompiled 32-bit version, it works well for me Anyway thank you for support