Error in compilation since yesterday without having modified anything

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
User avatar
PATRICKMULOT
Earned a small fee
Earned a small fee
Posts: 15
Joined: Tue Apr 25, 2017 6:07 pm

Error in compilation since yesterday without having modified anything

Post by PATRICKMULOT »

hello,
since yesterday I have an error in compilation and I can't find where is the problem !
In fact, when I compile my application, it generates a file 'pmApp.h.gch', and although I delete it, it is regenerated every time.

the error message (In red the error that causes me problem) :
g++ -Wall -std=c++11 -g -I/usr/local/lib/wx/include/gtk3-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Wall -std=c++11 -g -Idevel/headers -Idevel/sources -Idevel -Idevel/headers -Idevel/sources -c /home/patrick/CBProjects/pmGenealogie/devel/headers/pmApp.h -o devel/headers/pmApp.h.gch
...
devel/headers/pmApp.h.gch: file not recognized: Format de fichier non reconnu (Unrecognized file format)
collect2: error: ld returned 1 exit status
If someone can help me, I thank him/her in advance.
Patrick MULOT.
Lenovo-V17-G2-ITL - 11th Gen Intel Core i5-1135G7 CPU @ 2.40GHz × 8 - Ram 16 Gb - SSD 512 Go + 2 x 1 To
Ubuntu 22.04 LTS 64 bits - wxWidgets 3.2.2.1 - C++ - wxSqlite3
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Error in compilation since yesterday without having modified anything

Post by doublemax »

A quick google search found this:
https://stackoverflow.com/questions/294 ... -gch-files

Maybe you added the header file to the compilable files by accident?
Or switched on precompiled headers?
Use the source, Luke!
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Error in compilation since yesterday without having modified anything

Post by DavidHart »

Hi,

1) I was going to ask where your .cpp file(s) were, as you don't seem to mention them; but doublemax has already said much the same thing, better.

So:
2) This suggestion won't fix your current problem, but will save you from future ones: Don't put things like ' -I/usr/local/lib/wx/include/gtk3-unicode-3.0' in your compilation command. Instead call the wx-config script each time you build. That is much easier and more legible, and protects you from problems like a change of wx version.
Your compilation line should look something like:
g++ -g foo.cpp bar.cpp $(wx-config --cxxflags --libs) -l<non-wx-libs> -o <outputfilename>

Note that the cpp files come before the linker calls. If they weren't, linking would fail.

That line assumes the wx build you want to use is the first in your $PATH, and/or update-alternatives is set to point to it. Check by doing, in the same terminal:
which wx-config.
If the output gives the wrong wx build, change it for that terminal to the right one by doing:
export PATH=/full/path/to/correct/wx-config:$PATH

Regards,

David
Post Reply