News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Not obeying compiler flags

Started by lissalissa, March 27, 2022, 07:54:53 PM

Previous topic - Next topic

lissalissa

Hello friends,
I am trying to compile a project using wxWidgets.  I build the wx libraries from source, and after getting the compiler and linker flags from wx-config --cppflags and --libs respectively, I inserted the flags into the compiler and linker options in codeblocks.  And yet, when I try to build, it spits out no such file or directory errors for the files included from the wx libraries.
I'm doing this on Fedora 35 in codeblocks 20.03.
Any ideas?

stahta01

#1
IIRC, You need to put `wx-config --cppflags` in the other settings section.
The tilted single quotes are required.

Edit: I have always needed to close and reopen either the CB project or CB itself when the output of these shell command change under Windows OS. I have been told this is not needed under Linux and some people claim it is not needed under Windows; but, I have never gotten it to work with Win7.

Edit2: If you still have a problem post a build log with the gcc command and its error; because after I reread your post I realized I may have read it wrong. https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

BlueHazzard

QuoteEdit: I have always needed to close and reopen either the CB project or CB itself when the output of these shell command change under Windows OS. I have been told this is not needed under Linux and some people claim it is not needed under Windows; but, I have never gotten it to work with Win7.
You can see your backtick cache in settings->Backtick cache

lissalissa

It's still not working.  Here's the build log:


-------------- Clean: Debug in Patient Encoder (compiler: GNU GCC Compiler)---------------

Cleaned "Patient Encoder - Debug"

-------------- Build: Debug in Patient Encoder (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/addtogroup.cpp" -o obj/Debug/addtogroup.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/deletegroup.cpp" -o obj/Debug/deletegroup.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/group.cpp" -o obj/Debug/group.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/main.cpp" -o obj/Debug/main.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/mainwindow.cpp" -o obj/Debug/mainwindow.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/newgroup.cpp" -o obj/Debug/newgroup.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/newptdialog.cpp" -o obj/Debug/newptdialog.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/patient.cpp" -o obj/Debug/patient.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/plist.cpp" -o obj/Debug/plist.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/suffix.cpp" -o obj/Debug/suffix.o
g++  -o "bin/Debug/Patient Encoder - CB" obj/Debug/addtogroup.o obj/Debug/deletegroup.o obj/Debug/group.o obj/Debug/main.o obj/Debug/mainwindow.o obj/Debug/newgroup.o obj/Debug/newptdialog.o obj/Debug/patient.o obj/Debug/plist.o obj/Debug/suffix.o   -L/usr/wx3.0.5/wx-dynamic-build/lib -pthread   -Wl,-rpath,/usr/wx3.0.5/wx-dynamic-build/lib -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 
In file included from /home/alissa/Documents/development/Patient Encoder/main.cpp:3:
/home/alissa/Documents/development/Patient Encoder/mainwindow.h:5:10: fatal error: wx/wx.h: No such file or directory
    5 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/mainwindow.cpp:1:
/home/alissa/Documents/development/Patient Encoder/mainwindow.h:5:10: fatal error: wx/wx.h: No such file or directory
    5 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/newgroup.cpp:1:
/home/alissa/Documents/development/Patient Encoder/newgroup.h:7:10: fatal error: wx/wx.h: No such file or directory
    7 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/addtogroup.cpp:3:
/home/alissa/Documents/development/Patient Encoder/addtogroup.h:9:10: fatal error: wx/wx.h: No such file or directory
    9 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/deletegroup.cpp:1:
/home/alissa/Documents/development/Patient Encoder/deletegroup.h:11:10: fatal error: wx/wx.h: No such file or directory
   11 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/suffix.h:13,
                 from /home/alissa/Documents/development/Patient Encoder/suffix.cpp:4:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/group.h:12,
                 from /home/alissa/Documents/development/Patient Encoder/group.cpp:3:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/newptdialog.cpp:3:
/home/alissa/Documents/development/Patient Encoder/newptdialog.h:12:10: fatal error: wx/wx.h: No such file or directory
   12 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/patient.cpp:3:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
9 error(s), 0 warning(s) (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/group.h:12,
                 from /home/alissa/Documents/development/Patient Encoder/plist.h:13,
                 from /home/alissa/Documents/development/Patient Encoder/plist.cpp:3:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
10 error(s), 0 warning(s) (0 minute(s), 0 second(s))


stahta01

If you were on windows, I would be sure it is the spaces in the path "bin/Debug/Patient Encoder - CB" that caused the problem.
I have no idea if the same problem exists for Linux users.
I would also avoid the dash "-" in the path.

I suggest doing the path changes and see if it fixes the issue.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

BlueHazzard

Also check if /usr/wx3.0.5/include/wx/wx.h exists

stahta01

Did you install the "devel" package? And you might need the "wxBase" "devel" package?

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

lissalissa

wxBase is installed, although I built the library from source and am passing the flags spit out by wx-config from the directory where I built the library.  I checked, and yes the wx.h file does exist in the directory where it's expected as suggested.  I'm still getting the following build log:


-------------- Build: Debug in Patient Encoder (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/addtogroup.cpp" -o obj/Debug/addtogroup.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/deletegroup.cpp" -o obj/Debug/deletegroup.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/group.cpp" -o obj/Debug/group.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/main.cpp" -o obj/Debug/main.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/mainwindow.cpp" -o obj/Debug/mainwindow.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/newgroup.cpp" -o obj/Debug/newgroup.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/newptdialog.cpp" -o obj/Debug/newptdialog.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/patient.cpp" -o obj/Debug/patient.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/plist.cpp" -o obj/Debug/plist.o
g++ -Wall -fexceptions -g -I/usr/wx3.0.5/wx-dynamic-build/lib/wx/include/gtk3-unicode-3.0 -I/usr/wx3.0.5/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__  -c "/home/alissa/Documents/development/Patient Encoder/suffix.cpp" -o obj/Debug/suffix.o
g++  -o "bin/Debug/Patient Encoder" obj/Debug/addtogroup.o obj/Debug/deletegroup.o obj/Debug/group.o obj/Debug/main.o obj/Debug/mainwindow.o obj/Debug/newgroup.o obj/Debug/newptdialog.o obj/Debug/patient.o obj/Debug/plist.o obj/Debug/suffix.o  -L/usr/wx3.0.5/wx-dynamic-build/lib -pthread   -Wl,-rpath,/usr/wx3.0.5/wx-dynamic-build/lib -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 
In file included from /home/alissa/Documents/development/Patient Encoder/main.cpp:3:
/home/alissa/Documents/development/Patient Encoder/mainwindow.h:5:10: fatal error: wx/wx.h: No such file or directory
    5 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/mainwindow.cpp:1:
/home/alissa/Documents/development/Patient Encoder/mainwindow.h:5:10: fatal error: wx/wx.h: No such file or directory
    5 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/newgroup.cpp:1:
/home/alissa/Documents/development/Patient Encoder/newgroup.h:7:10: fatal error: wx/wx.h: No such file or directory
    7 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/addtogroup.cpp:3:
In file included from /home/alissa/Documents/development/Patient Encoder/deletegroup.cpp:1:
/home/alissa/Documents/development/Patient Encoder/deletegroup.h:11:10: fatal error: wx/wx.h: No such file or directory
   11 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/group.h:12,
                 from /home/alissa/Documents/development/Patient Encoder/group.cpp:3:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/patient.cpp:3:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

/home/alissa/Documents/development/Patient Encoder/addtogroup.h:9:10: fatal error: wx/wx.h: No such file or directory
    9 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/suffix.h:13,
                 from /home/alissa/Documents/development/Patient Encoder/suffix.cpp:4:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/newptdialog.cpp:3:
/home/alissa/Documents/development/Patient Encoder/newptdialog.h:12:10: fatal error: wx/wx.h: No such file or directory
   12 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

In file included from /home/alissa/Documents/development/Patient Encoder/group.h:12,
                 from /home/alissa/Documents/development/Patient Encoder/plist.h:13,
                 from /home/alissa/Documents/development/Patient Encoder/plist.cpp:3:
/home/alissa/Documents/development/Patient Encoder/patient.h:10:10: fatal error: wx/wx.h: No such file or directory
   10 | #include <wx/wx.h>
      |          ^~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
10 error(s), 0 warning(s) (0 minute(s), 0 second(s))


sodev

First of all, you have a very strange path setup of wxWidgets, it seems like you have set the prefix to /usr/wx3.0.5 and a custom lib location of wx-dynamic-build/lib. Now that you are self-building wxWidgets, why do you build that old version instead of the current release? Anyway, it looks like your include path to the main includes is wrong, i have only a recent wxWidgets 3.1 snapshot, but i don't think they changed the path setup. The proper include path should be /usr/wx3.0.5/include/wx-3.0.

lissalissa

Quote from: sodev on March 30, 2022, 09:08:34 PM
First of all, you have a very strange path setup of wxWidgets, it seems like you have set the prefix to /usr/wx3.0.5 and a custom lib location of wx-dynamic-build/lib. Now that you are self-building wxWidgets, why do you build that old version instead of the current release? Anyway, it looks like your include path to the main includes is wrong, i have only a recent wxWidgets 3.1 snapshot, but i don't think they changed the path setup. The proper include path should be /usr/wx3.0.5/include/wx-3.0.

So I've verified that the path is correct.  When I navigate to /usr/wx3.0.5/include there is indeed a wx folder containing wx.h, and it's clearly being pointed to by compiler flags so I am at a loss.  I tried installing wx and the devel libraries from the repository and use the flags spit out by wx-config for that, and it still doesn't work.  I added the include directory manually into the search paths option under build options in CB, still getting the same errors.  I'm not sure what else I'm supposed to be trying.

Also, I'm using the older version because my code breaks with the 3.1 lineage, and I'd love to figure that out too but first I gotta get this project compiling again.  I should say that this error started happening after I migrated the project from Ubuntu to Fedora.

lissalissa

Figured it out!  I had CB installed as a flatpak, so the root directory was different.  Ditched the flatpak, installed from the rpm, and now everything is working!

BlueHazzard

Good old flatpack problems....
i do not know who made this flatpack builds, but they give us a headache

Miguel Gimenez

#12
I was investigating about flatpack detection, so we can warn the user about possible problems, but did not find anything reliable.
Probably we could try accessing a system file, at the risk of being marked as a virus.

EDIT: /etc is blacklisted, we can try to read a world readable file (like hosts or passwd ;) ) and show an Annoying Dialog saying something like "Running C::B in Flatpack can cause problems, if you need help please mention you are using Flatpack"