How do I correctly set up WXWidgets on Ubuntu? My editor tells me the header files are incorrect - installation

I wanted to try out the WXWidgets Hello World example (https://docs.wxwidgets.org/latest/overview_helloworld.html) so I followed the recommended practice on the Downloads page and installed the WXGTK package for my distribution, Ubuntu, which appears to be libwxgtk3.0-gtk3-dev. After doing this, and copying the example code, g++ (installed from build-essentials) throws an error when I attempt to compile the program:
wxtest.cpp:4:10: fatal error: wx/wxprec.h: No such file or directory
4 | #include <wx/wxprec.h>
| ^~~~~~~~~~~~~
compilation terminated.
My editor (VSCode) also shows me an error: cannot open source file "wx/wxprec.h".
This appears to be related to the fact that the WXWidgets header files are installed to the folder wx-3.0/wx instead of wx, but after changing #include <wx/wxprec.h> to #include <wx-3.0/wx/wxprec.h> I still get an error:
In file included from wxtest.cpp:4:
/usr/include/wx-3.0/wx/wxprec.h:12:10: fatal error: wx/defs.h: No such file or directory
12 | #include "wx/defs.h"
| ^~~~~~~~~~~
compilation terminated.
What am I doing wrong? How can these files be put in the right place?

See the building your project section of the docs.

Related

Cannot build package due to missing GCC headers in Buildroot (stdio.h)

Recently, I updated the Buildroot directory from 2019.11 to 2022.2 in order to build for a new board (RPi4B Rev1.5) and access the updated Linux kernel and headers. Unfortunately, I have been unable to build due to missing headers for the SWUpdate package.
An extract of the error is below. The full log can be found at this link (as it is long).
CC tools/swupdate-client.o
ipc/network_ipc-if.c:8:10: fatal error: stdio.h: No such file or directory
8 | #include <stdio.h>
| ^~~~~~~~~
ipc/network_ipc.c:9:10: fatal error: stdio.h: No such file or directory
9 | #include <stdio.h>
| ^~~~~~~~~
compilation terminated.
In file included from /home/haelyons/project_folder/buildroot/output/host/lib/gcc/arm-
buildroot-linux-gnueabihf/10.3.0/include-fixed/syslimits.h:7,
from /home/haelyons/project_folder/buildroot/output/host/lib/gcc/arm-buildroot-
linux-gnueabihf/10.3.0/include-fixed/limits.h:34,
from parser/parse_external.c:10:
/home/haelyons/project_folder/buildroot/output/host/lib/gcc/arm-buildroot-linux-
gnueabihf/10.3.0/include-fixed/limits.h:195:15: fatal error: limits.h: No such file or
directory
Essentially, as this is a package included with Buildroot, I am not sure if the issue is with my installation of GCC, or with the package itself referencing the incorrect folder. If possible, I would greatly appreciate some pointers in the right direction such as more tests that I could perform to diagnose this. Thanks, H.
After more research, it turns out this was an issue with the configuration path assigned within the Buildroot config. It was referring to the RPi3 configuration, which required a different kernel and GCC version. The fix involved the following:
make nconfig
# Navigate to: Target Packages > System Tools > SWUpdate Config Path
# Update the patch to the new board's config - BR2_EXTERNAL=<path>
make -C savedefconfig BR2_DEFCONFIG=../<config path>

"'glib.h' file not found" when I make source project in mac OS

I created MakeFile using Autoconf. When I run "make" in my source project, errors like below occur. But glib is installed. Does anyone have a solution to this problem? I'm using thrift library in my project.
/usr/local/include/thrift/c_glib/thrift.h:27:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
I tried this command but it didn't fix this problem.
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

error: unknown type name 'uint64_t' on MacOS while installing libraries

Kept getting the following error when trying to install Apache Airflow by
pip install apache-airflow
I removed command line tools, upgraded OS from Mojave to Catalina, re installed xcode using xcode-select --install even then the following errors failed to get resolved :-
---many similar lines---
In file included from /usr/local/include/stdint.h:59:
In file included from /usr/local/include/stdint.h:59:
In file included from /usr/local/include/stdint.h:59:
/usr/local/include/stdint.h:2:10: error: #include nested too deeply
#include <stddef.h>
^
/usr/local/include/stdint.h:72:11: error: #include nested too deeply
# include <sys/types.h>
^
/usr/local/include/stdint.h:82:11: error: #include nested too deeply
# include <inttypes.h>
^
In file included from src/setproctitle.c:14:
In file included from src/spt.h:15:
In file included from src/spt_python.h:14:
---many similar lines---
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'clang' failed with exit status 1
Read these issues on Github https://github.com/giampaolo/psutil/issues/1388 and https://github.com/cython/cython/issues/2009
Renamed my folder /usr/local/include to /usr/local/include_old for keeping it as backup in case even this doesn't work
mv /usr/local/include /usr/local/include_old
and then ran same installation command again:-
pip install apache-airflow
which worked flawlessly this time.

How to fix "error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'? _VSTD::abort();"

Platform: Macos Catalina 10.15.2
Xcode version: Xcode 11
I have tried many times to make-all gcc to build my source code. However, I have encountered a problem:
In file included from ../.././gcc/c/c-objc-common.c:33:
In file included from /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:85:
/Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:181:5: error:
no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
_VSTD::abort();
^~~~~~~ /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:873:15: note:
expanded from macro '_VSTD' # _VSTD std::_LIBCPP_ABI_NAMESPACE
^ ../.././gcc/system.h:685:13: note: 'fancy_abort' declared here extern void fancy_abort (const char *, int, const char
*) ATTRIBUTE_NORETURN;
^
1 error generated.
make[1]: *** [c/c-objc-common.o] Error 1
make: *** [all-gcc] Error 2
I have tried to install another version of Xcode. I have installed Xcode6 but it still did not work, and I found a solution of this issue. But when I download Xcode8.3.3, it is not compatible with Catalina 10.15.2.
I ran in to this issue while using crosstools-ng on mac (mojave 10.14) to compile cross-platform toolchain with gcc 4.9.
Solution: Edit .build/src/gcc-4.9.4/gcc/system.h to add #include <map> in #ifdef __cplusplus block where other include statements are.
The problem is that is included (via ) after abort has been
defined as a macro to fancy_abort. And thus when the C++ standard headers try
to call std::abort, they end up calling std::fancy_abort, which of course
doesn't exist.
Source: https://gcc.gnu.org/legacy-ml/gcc-bugs/2017-09/msg00154.html

Error building OpenCV with mingw under Windows 10

I tried to build the opencv Library on my Windows 10 PC.
I managed to generate everything from source with cmake. (Nothing red, no errors).
When I try to build everything with mingw (mingw32-make install)
It starts building and after a while I get the following error.
[ 76%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj
In file included from C:/Python34/include/Python.h:8:0,
from C:\OpenCV\opencv-master\modules\python\src2\cv2.cpp:6:
C:/Python34/include/pyconfig.h:440:5: warning: "_MSC_VER" is not defined [-Wundef]
#if _MSC_VER >= 1800
^~~~~~~~
In file included from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/6.2.0/include/c++/math.h:36:0,
from C:/Python34/include/pyport.h:328,
from C:/Python34/include/Python.h:50,
from C:\OpenCV\opencv-master\modules\python\src2\cv2.cpp:6:
C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/lib/gcc/x86_64-w64-mingw32/6.2.0/include/c++/cmath:1133:11: error: '::hypot' has not been declared
using ::hypot;
^~~~~
modules\python3\CMakeFiles\opencv_python3.dir\build.make:179: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj' failed
mingw32-make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj] Error 1
CMakeFiles\Makefile2:7051: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
mingw32-make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I found the following "Error: '::hypot' has not been declared" in cmath while trying to embed Python
But could not figured it out.
Can Anyone hint me in the direction. Where are those includes in the case of building OpenCV?
Versions:
OpenCV 3.2.0,
CMake 3.4.1,
GNU Make 4.1
Any help qould be appreciated!
Go to the following file
C:\OpenCV\opencv-master\modules\python\src2\cv2.cpp
and see if
#include "Python.h"
comes before #include <cmath>.
In that case exchange the order, i.e. write
#include <cmath>
#include "Python.h"
so that cmath comes before Python.h.
Try to build and see if that solves at list the error that you reported.

Resources