wxAutoExcel issue

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
TakaTakata
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Apr 09, 2020 2:21 pm

wxAutoExcel issue

Post by TakaTakata » Thu Apr 09, 2020 2:37 pm

Hello,

I have been using wxWidgets ( 3.1.2 latelly ) with MINGW-W64 for some time and I was trying to add wxAutoExcel library too. The fact is that I can't sucessfully compile the minimal sample that comes with the package.
My question is:
. I am trying to compile (x64) but I am getting an error of undefined reference to wxAutomation Object of the functions on the sample. I follow the install.txt instructions but with no success. Does anyone had such a issue with these libraries ? These libraries are only for 32 bits ?

Thanks

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2463
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxAutoExcel issue

Post by PB » Thu Apr 09, 2020 5:56 pm

(I am the author of wxAutoExcel)

The only way wxAutoExcel officially supports MinGW is through CMake. 64-bit MinGW compiler (GCC 7.2) is used to test the build on AppVeyor and building the samples as well as the library with it works:
https://ci.appveyor.com/project/pbforde ... 8u8f9ms512

wxAutomationObject is in wxCore, so you already link with this library in any wxWidgets application.

You need to provide the details, at least:
* exact build tools (MinGW, mingw-w64) and version, e.g. the output of gcc -v,
* build settings (command line, DLL/static, Debug/Release),
* exact error message(s).

EDIT
I tried to build a library with CMake and create a minimal sample in Code::Blocks, using mingw-w64 (x86_64-8.1.0-win32-seh-rt_v6-rev0). Worked just fine.
My guess would be that your undefined references errors are the usual GCC newbie mistake. With GCC, order of the libraries to link with matters: if library A references library B, library B must be listed before library A.
In your case, wxAutoExcel library must be listed before wxWidgets libraries, e.g.
wxautoexcel lib.png
wxautoexcel lib.png (26.49 KiB) Viewed 339 times

TakaTakata
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Apr 09, 2020 2:21 pm

Re: wxAutoExcel issue

Post by TakaTakata » Sun Apr 12, 2020 8:01 pm

Thanks PB for your quick reply.

Just give me some time to gather more information ; to add something now, the baseline for me was build the library inside codeblocks selecting the option of a static library ( x64 ). Then I tried to compile the minimal project.
I don't have CMAKE ( and don't now how to use it )
I will be back to this forum asap

Thanks again

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2463
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxAutoExcel issue

Post by PB » Sun Apr 12, 2020 8:36 pm

I do not know much about CMake myself, but using cmake-gui is quite easy and intuitive. When building the library I just used a batch file containing this

Code: Select all

PATH=C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin;C:\Program Files\CMake\bin;%PATH%
cmake-gui
selected "MinGW makefiles" generator and then went ahead in the GUI according to the wxAutoExcel Cmake instructions. The CMake configure output for the static release build looked like this (I use WXWIN/lib/gcc_x64_lib because my WXWIN/lib/gcc_lib hosts the 32-bit version
wxAE_CMake.png
wxAE_CMake.png (56.12 KiB) Viewed 281 times

Code: Select all

Configured wxAutoExcel 1.0.0 for MinGW Makefiles (C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/g++.exe, v8.1.0)
    Build type:                      STATIC
    Build configuration:             Release
    Use static runtime:              OFF
    Architecture:                    64-bit
    Library output folder:           D:/Dev/Desktop/!Lib/wxAutoExcel-build-gcc810-x64-lib-release/lib
    Runtime folder (DLLs + samples): D:/Dev/Desktop/!Lib/wxAutoExcel-build-gcc810-x64-lib-release/bin
    Use precompiled headers:         ON
    Build samples:                   ON
    ------
    wxWidgets version:               3.1.4
    wxWidgets link shared:           OFF
    wxWidgets library folder:        D:/Dev/Desktop/!Lib/wxWidgets-GIT/lib/gcc_x64_lib
Generally speaking, one is not expected to build a C++ library by himself (it can be non-trivial), but use the make/project files shipped with the library.

EDIT
I tried building the library in CodeBlocks and even with my very basic knowledge of CB I had the project set up and building in about three minutes.

TakaTakata
In need of some credit
In need of some credit
Posts: 3
Joined: Thu Apr 09, 2020 2:21 pm

Re: wxAutoExcel issue

Post by TakaTakata » Sun Apr 12, 2020 9:11 pm

Hello PB,

Meanwhile I manage to compile the minimal sample. I guess that the issue was not having the libwxAutoExcel64u.a in first place in Link libraries . . . I am not sure.

To resume this all:

. I have the wxWidgets 3.1.2 compiled with MINGW-w64 7.2.1

. The compile string is:
mingw32-make -f makefile.gcc CFLAGS="-m64" CXXFLAGS="-m64 -std=gnu++11" LDFLAGS="-m64" BUILD=release SHARED=0 UNICODE=1 MONOLITHIC=0 USE_GUI=1 RUNTIME_LIBS=static DEBUG_FLAG=1

. I buid the autoexcel library above with codeblocks project in attachment.

. Then I compiled the minimal sample with the project in attachment

Thanks again PB for your help

TakaTakata
Attachments
Attachments.zip
Attachments
(2.99 KiB) Downloaded 19 times

Post Reply