CppPilot

C++ / Recherche dans la documentation

Trouver l’erreur. Trouver la prochaine étape.

Recherchez par code de diagnostic, message copié ou symptôme. Filtrez par contenu et système de projet.

  1. Exemples et schémasMSBuild + CMake

    LNK2005 : un fichier .cpp est inclus.

    #include "util.cpp" compiles that file twice. Include its header instead.

  2. Exemples et schémasMSBuild + CMake

    LNK2005 : une fonction est définie dans un en-tête sans inline.

    Mark it inline , or keep only its declaration in the header and move its body to a .cpp file. Member functions defined inside the class are already inline.

  3. Exemples et schémasMSBuild + CMake

    LNK2005 : une variable est définie dans un en-tête.

    Every .cpp file that includes the header defines it again. Declare it extern int counter; in the header and define it in one .cpp file, or make it inline int counter = 0; in C++17.

  4. Exemples et schémasMSBuild + CMake

    LNK2005 : les symboles du runtime sont définis deux fois.

    Symbols already defined in LIBCMT.lib or MSVCRT.lib mean that libraries built with /MT and /MD are mixed: use the same runtime everywhere, as for LNK2038 .

  5. Exemples et schémasMSBuild + CMake

    LNK2005 : deux bibliothèques définissent le même symbole.

    Liez une seule des deux bibliothèques ou renommez le symbole dans le code que vous contrôlez.

  6. Exemples et schémasMSBuild + CMake

    LNK2019 : main ou WinMain est absent.

    An unresolved main referenced in invoke_main means that Linker > System > SubSystem does not match the entry point: Console expects main , Windows expects WinMain .

  7. Exemples et schémasMSBuild + CMake

    LNK2019 : un modèle ou une fonction inline est défini dans un fichier .cpp.

    Déplacez sa définition dans l’en-tête : elle doit être visible partout où elle est utilisée.

  8. Exemples et schémasMSBuild + CMake

    LNK2019 : du code C est appelé depuis C++ sans extern "C".

    Wrap the C declarations in extern "C" { } in the header, so that C++ looks for the undecorated name.

  9. Exemples et schémasMSBuild + CMake

    LNK2019 : le fichier .cpp qui la définit ne fait pas partie du projet.

    Ajoutez le fichier au projet dans l’Explorateur de solutions : un fichier présent sur disque mais absent du projet n’est jamais compilé.

  10. Exemples et schémasMSBuild + CMake

    LNK2019 : la déclaration et la définition ne correspondent pas.

    Compare the signature: a missing const , a different parameter type, another namespace, or a member function defined without its Class:: prefix declares a different symbol.

  11. Exemples et schémasMSBuild + CMake

    LNK2019 : la fonction est déclarée mais jamais définie.

    Écrivez son corps ou supprimez l’appel. Une déclaration dans un en-tête promet seulement qu’une définition existe quelque part.

  12. Exemples et schémasMSBuild + CMake

    LNK2019 : la bibliothèque qui la définit n’est pas liée.

    Add the .lib to Linker > Input > Additional Dependencies and its folder to Linker > General > Additional Library Directories , for every configuration and platform. For a library built in the same solution, add a project reference instead.

  13. Exemples et schémasMSBuild + CMake

    LNK2019 : la bibliothèque a été compilée pour une autre plateforme.

    Liez la bibliothèque x64 dans les compilations x64 et la bibliothèque x86 dans les compilations Win32.

  14. Exemples et schémasMSBuild + CMake

    LNK2026 : une bibliothèque a été compilée avec un ancien compilateur.

    Recompilez la bibliothèque avec le jeu d’outils actuel ou procurez-vous une compilation récente.

  15. Exemples et schémasMSBuild + CMake

    LNK2026 : un fichier assembleur est assemblé sans /safeseh.

    Set Microsoft Macro Assembler > Advanced > Use Safe Exception Handlers to Yes.

  16. Exemples et schémasMSBuild + CMake

    LNK2026 : la bibliothèque ne peut pas être recompilée.

    Set Linker > Advanced > Image Has Safe Exception Handlers to No (/SAFESEH:NO) , for Win32 only. This removes a protection, so prefer rebuilding.

  17. Exemples et schémasMSBuild + CMake

    LNK2038 : une bibliothèque Release est liée à une compilation Debug.

    A mismatch on _ITERATOR_DEBUG_LEVEL (0 against 2) means that Debug and Release code are mixed: link the Debug version of the library in Debug builds.

  18. Exemples et schémasMSBuild + CMake

    LNK2038 : une bibliothèque tierce précompilée utilise un autre runtime.

    Utilisez la variante compilée pour votre runtime ou recompilez-la avec vos paramètres, par exemple avec le triplet vcpkg correspondant.

  19. Exemples et schémasMSBuild + CMake

    LNK2038 : un fichier utilise un réglage propre qui prend le pas sur celui du projet.

    A .cpp file can have its own Runtime Library setting. Remove the override in its properties so it inherits the project's.

  20. Exemples et schémasMSBuild + CMake

    LNK2038 : les projets utilisent des runtimes différents.

    Set the same C/C++ > Code Generation > Runtime Library in every project of the program: /MD everywhere, or /MT everywhere, with /MDd or /MTd in Debug.