Hi I would really appreciate some thoughts about what is going on with this error message.
I made a minimal reproducible example using the code samples from the gtkmm-4-8 book I won’t mention the chapter because that will change depending on the version
The steps to reproduce this is as follow:
I’m defining a gresource.xml file that bundles the resources I need
Hi, thank you for you interest to help.
Those files (src/exampleapp.c, and include/exampleapp.h) are the output of glib-compile-resources --generate-header and glib-compile-resources --generate-source.
The binary is the result of not specifying those parameters
I did get a binary but I didn’t want to use it given that the documentation says it is not what people normally do.
PS I could try … make the project to use the binary instead. It is something to explore. I will let you know if it works
New update: I’ve also found an error with the Makefile because instead of editing the rule to update-sources-list I changed the rule for format the code so the files were not getting included in the sources to get compiled by cmake. But that happened only in this sample project, the update-sources-list rule was working as expected in the project I’m working and it didn’t work. HOWEVER, I think you’re right. Indicating a target could work. I’m sure cmake will not compile a .gresource along the C++ files however I can indicate the target as parameter. So this could work and you would be right
I’ve created a new branch (dev). That branch is using the generated file.
You may find this output of glib-compile-resources more familiar, however link that to the project is not as easy as pushing the files because now I have to build this target_sources I’ve incorporated (without reading the full description on cmake documentation I should add). I need to build this target not just link to the executable.
I guess that’s the reason people prefer to use the header and source files.
I will try.
But I think I have to give some update of what I’ve tried already in case this doesn’t work or in case some one else provide a solution:
branch main was compiling the sources along the project’s source and headers (didn’t work)
branch nither-as-a-library was using this files (header and source produced by glib-compile-resources) to build a library and then link that library to the project’s executable (didn’t work)
branch dev is not properly configured (the cmake command was used incorrectly) so the main utility/purpose of that branch was to expose the file already processed by glib-configure-resources (not as a source or header file). The problem with using this tyle type is that cmake does not build the target so I need a different cmake command to integrate that executable.
As I said I will try this approach. I saw this type of usage and I have to say I dislike it. There is no point in doing all that extra work when I can run the command to produce the sources (or gresource). All I need to do is link it to the executable. I’m really surprised the branch neither-as-a-library didn’t work honestly
OK, done! It was fault of a task in the Makefile set incorrectly. I fixed that in another branch but not in main which was using the header and source files generated by glib-compile-resources correctly. I think it has to be dev because dev was not linking the resources to the project correctly, hence it didn’t work either.
I will take look at neighter-as-a-librarybranch again because that one was using the files to build a library and link it correctly.
Anyway what is important is that this should work and now it does.
Note: It does need the declaration of C language along the c++ to work correctly, i.e.