jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.48k stars 330 forks source link

cannot run on x64 Release in Visual Studio 2022 #433

Closed SJavad closed 4 months ago

SJavad commented 5 months ago

I try every step in the installation guide I built the project with x64 Release the build was successful but when I ran the .exe file I got this error: The Application was unable to start correctly (0xc0000007b). Click OK to close the application.

what can I do?

#include "xlsxwriter.h"

int main() {

    /* Create a new workbook and add a worksheet. */
    lxw_workbook* workbook = workbook_new("demo.xlsx");
    lxw_worksheet* worksheet = workbook_add_worksheet(workbook, NULL);

    /* Add a format. */
    lxw_format* format = workbook_add_format(workbook);

    /* Set the bold property for the format */
    format_set_bold(format);

    /* Change the column width for clarity. */
    worksheet_set_column(worksheet, 0, 0, 20, NULL);

    /* Write some simple text. */
    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);

    /* Text with formatting. */
    worksheet_write_string(worksheet, 1, 0, "World", format);

    /* Write some numbers. */
    worksheet_write_number(worksheet, 2, 0, 123, NULL);
    worksheet_write_number(worksheet, 3, 0, 123.456, NULL);

    /* Insert an image. */
    worksheet_insert_image(worksheet, 1, 2, "logo.png");

    workbook_close(workbook);

    return 0;
}
jmcnamara commented 5 months ago

Some questions/comments:

  1. Which method in the getting started guide did you follow?
  2. That "Application was unable to start correctly (0xc0000007b)" error is often caused by a difference between a 32 bit app and a 64bit system or the other way round. Double check that your compilation target matches your OS.
  3. If you omit the libxlsxwriter parts of the code and turn it into a simple "hello world" program, does it run okay or do you get the same error.
  4. Do you have system permissions to run an exe file from the directory it is created in.

Please answer each of these when you reply.

jmcnamara commented 5 months ago

Any update on this?

SJavad commented 5 months ago

@jmcnamara 1- I try this section Using CMake for Microsoft Visual Studio 2- Yes I do, my compile target and system is x64 3- yeah the program without libxlswriter work's fine 4- yes I Do.

jmcnamara commented 5 months ago

Could you try the VCPKG method instead: http://libxlsxwriter.github.io/getting_started.html#gsg_vcpkg

jmcnamara commented 4 months ago

Closing as can't replicate.