jpakkane / chapterizer

A book generator
Apache License 2.0
23 stars 0 forks source link

Compiler Error about G_APPLICATION_DEFAULT_FLAGS #2

Open johnblommers opened 1 year ago

johnblommers commented 1 year ago

The final building step running ninja errored out:

ninja
[20/26] Compiling C++ object guitool.p/guitool.cpp.o
FAILED: guitool.p/guitool.cpp.o
ccache c++ -Iguitool.p -I. -I.. -I/usr/include/gtk-4.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++20 -g -Wshadow -mfpmath=sse -msse -msse2 -pthread -MD -MQ guitool.p/guitool.cpp.o -MF guitool.p/guitool.cpp.o.d -o guitool.p/guitool.cpp.o -c ../guitool.cpp
../guitool.cpp: In function ‘int main(int, char**)’:
../guitool.cpp:766:69: error: ‘G_APPLICATION_DEFAULT_FLAGS’ was not declared in this scope; did you mean ‘G_APPLICATION_GET_CLASS’?
  766 |     app.app = gtk_application_new("io.github.jpakkane.chapterizer", G_APPLICATION_DEFAULT_FLAGS);
      |                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                     G_APPLICATION_GET_CLASS
[21/26] Compiling C++ object libchap.a.p/metadata.cpp.o
ninja: build stopped: subcommand failed.

Do you have any suggestion on how to fix this? My building process:

sudo apt install libhyphen-dev \
                 libgtk-4-dev \
                 libtinyxml2-dev \
                 nlohmann-json3-dev \
                 libvoikko-dev
git clone https://github.com/jpakkane/chapterizer.git
cd chapterizer
mkdir build
cd build
meson ..
ninja
jpakkane commented 1 year ago

Your glib version is too old. You can edit the code to say G_APPLICATION_FLAGS_NONE instead. Guitool is an optional target, so you can also uninstall libgtk-4-dev, delete the build dir and recreate it again and it won't try to build that app.

jpakkane commented 1 year ago

Whoops, sorry, I misremembered. Pdfviewer is not actually optional (even though it could be).

johnblommers commented 1 year ago

G_APPLICATION_DEFAULT_FLAGSG_APPLICATION_FLAGS_NONE in line 766 of guitool.cpp

Excellent and thank you. This worked and I was able to compile and run the guitool without further excitement.