CppServer icon indicating copy to clipboard operation
CppServer copied to clipboard

#error config.h must be included before this header bfd.h

Open Freggels opened this issue 4 years ago • 0 comments
trafficstars

System

  • OS: GNU/Linux
  • Distribution: Arch
  • Architecture: x86_64 (amd64)

Issue

i was compiling your library as described in the README.md and encountered the following error:

In file included from /home/hguy/gits/CppServer/modules/CppCommon/source/system/stack_trace.cpp:21:
/usr/include/bfd.h:35:2: error: #error config.h must be included before this header
   35 | #error config.h must be included before this header

i found the relevant lines in /usr/include/bfd.h

#if !defined PACKAGE && !defined PACKAGE_VERSION
#error config.h must be included before this header
#endif

Solution

and solved the issue by adding the following to CMakeLists.txt

add_compile_definitions("PACKAGE=cppserver")
add_compile_definitions("PACKAGE_VERSION=1")

That's not the most beautiful solution, but i was just looking around.

see also: https://stackoverflow.com/questions/11748035/binutils-bfd-h-wants-config-h-now (That post seems to be 8 years old, so the problem probably lies somewhere else)

Freggels avatar Dec 28 '20 14:12 Freggels