Outils pour utilisateurs

Outils du site


probleme:compilation:c

hidden symbol `atexit' in /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS) is referenced by DSO

Erreur survenant avec clang et non gcc. Message complet :

/usr/bin/ld: XXX: hidden symbol `atexit' in /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS) is referenced by DSO

/usr/bin/ld: final link failed: Bad value

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution : Ajouter -fno-use-cxa-atexit à CXXFLAGS.

error: request for member 'XXXX' in 'XXXX', which is of non-class type ‘XXXX()’

Soit une classe CContexte avec un constructeur vide. Lors de la déclaration d'une instance (de nom projet) dans la pile, il pourrait être naturel d'écrire CContexte projet ();.

Ne pas le faire, en effet, dans ce cas, g++ considère ici la déclaration d'un prototype d'une fonction plutôt que la déclaration d'une variable avec son constructeur vide.

La bonne solution est d'écrire :

CContexte projet;

ou

CContexte projet{};

error: expected class-name before '{' token

Référence circulaire lors de l'inclusion de header, y compris s'ils sont protégés par le système des #ifndef #define.

error: weak declaration of 'XXXX' must be public

Ajouter l'attribut extern à la variable globale.

// __attribute__ ((weak)) const unsigned short STRUCT_BUF_SAVE_SIZE = 3000;
__attribute__ ((weak)) extern const unsigned short STRUCT_BUF_SAVE_SIZE = 3000;

error: there are no arguments to 'XXXX' that depend on a template parameter, so a declaration of 'XXXX' must be available [-fpermissive]

error: there are no arguments to 'XXXX' that depend on a template parameter, so a declaration of 'XXXX' must be available [-fpermissive]

error: there are no arguments to 'XXXX' that depend on a template parameter, so a declaration of 'XXXX' must be available [-fpermissive]
note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)

Il manque le #include <xxxx.h> de la fonction XXXX.

error: static assertion failed: comparison object must be invocable as const

/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_tree.h: In instantiation of 'class std::_Rb_tree<std::unique_ptr<llgc::software::gdb::Stack>, std::unique_ptr<llgc::software::gdb::Stack>, std::_Identity<std::unique_ptr<llgc::software::gdb::Stack> >, llgc::software::gdb::SetStack::LocalCompare, std::allocator<std::unique_ptr<llgc::software::gdb::Stack> > >':
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_multiset.h:134:17:   required from 'class std::multiset<std::unique_ptr<llgc::software::gdb::Stack>, llgc::software::gdb::SetStack::LocalCompare>'
.../lib2lgc/src/2lgc/software/gdb/set_stack.h:272:55:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_tree.h:457:21: error: static assertion failed: comparison object must be invocable as const
       static_assert(is_invocable_v<const _Compare&, const _Key&, const _Key&>,

Dans la classe llgc::software::gdb::SetStack::LocalCompare passer l'opérateur operator() à const.

Comparison object being invocable as const Archive du 08/07/2018 le 28/04/2020

probleme/compilation/c.txt · Dernière modification : 2022/10/05 14:16 de root