IdentifiantMot de passe
Loading...
Mot de passe oubli� ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les r�ponses en temps r�el, voter pour les messages, poser vos propres questions et recevoir la newsletter

VC++ .NET Discussion :

cr�ation d'un .lib : pb avec la stl


Sujet :

VC++ .NET

Vue hybride

Message pr�c�dent Message pr�c�dent   Message suivant Message suivant
  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7
    D�tails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7
    Par d�faut cr�ation d'un .lib : pb avec la stl
    environnement de developpement : Visual 2005

    je cherche � creer une solutions avec plusieurs projets:
    _ un principal (A)
    _ les autres pour generer des .lib utilis�s par le projet principal (B,C,...)

    J'ai donc mes projets B,C,... qui sont configur�s pour creer des .lib dans un meme dossier,
    et mon projet A qui est configur� pour utilis� ses librairies

    Est ce qu'il est necessaire de faire dependre les projet A des projets B,C,... pour qu'ils soient compil�s avant ?

    (cad utiliser l'outil "project dependencies")

    ou y a t'il un autre moyen ?

    pour en revenir a mon probeleme avec la stl, j aimerais utiliser par exemple le "cout" dans le projet B et j ai l'impression que le compilateur n'aime pas ca.

    1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
    ...etc

    que des erreurs LNK2005

    j'ai juste mis dans le .h du projet B (projet simple avec un .cpp et un .h) :

    #include <iostream>
    using namespace std;

    alors... est-il possible d'inclure dans une librairie de la librairie standard ?

    en vous remerciant d'avance

    merci de penser aux balises / nico-pyright(c)

  2. #2
    R�dacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    D�tails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Par d�faut
    t'as essay� de tout compiler en multithread ? /MT

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7
    D�tails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7
    Par d�faut
    non mais la n 'est pas le probleme, je cherche pas a resoudre rapidement mon probleme mais a comprendre porquoi j'ai ce probl�me

  4. #4
    r0d
    r0d est actuellement connect�
    Membre exp�riment�

    Homme Profil pro
    D�veloppeur informatique
    Inscrit en
    Ao�t 2004
    Messages
    4 299
    D�tails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rh�ne Alpes)

    Informations professionnelles :
    Activit� : D�veloppeur informatique

    Informations forums :
    Inscription : Ao�t 2004
    Messages : 4 299
    Billets dans le blog
    2
    Par d�faut
    Citation Envoy� par groumff
    Est ce qu'il est necessaire de faire dependre les projet A des projets B,C,... pour qu'ils soient compil�s avant ?
    Ce n'est pas n�cessaire mais c'est conseill�. Il s'agit plus de confort de d�veloppement (et de logique) que de n�cessit�. En effet, si ton projet principal utilise des dlls (ou lib) g�n�r�es par les autres projets de la solution, il est pr�f�rable que lorsque tu compile le tout, ce soit fait dans l'ordre. Ainsi, si tu d�termine correctement tes d�pendances, lorsque tu va faire ctrl+shift+b (ou F5, enfin, quand tu va compiler toute la solution) tout sera fait dans l'ordre.

    Autre chose, lorsque quelqu'un reprendra ton code, si les d�pendances sont bien d�termin�es, �a aide aussi pour comprendre l'architecture. Et plus il y a de projets inter-d�pendants, plus c'est important.

    Citation Envoy� par groumff
    ou y a t'il un autre moyen ?
    Oui, tu peux compiler tes projets les uns apr�s les autres...

    Citation Envoy� par groumff
    pour en revenir a mon probeleme avec la stl, j aimerais utiliser par exemple le "cout" dans le projet B et j ai l'impression que le compilateur n'aime pas ca.
    C'est �trange. Le cout est ce qu'il y a de plus standard en c++.

    ... apr�s, je ne comprends pas trop ce que tu demandes

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7
    D�tails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7
    Par d�faut
    je developpe une librairie et je voudrais utiliser une librairie standard comme par exemple <iostream> ou meme <vector> ce qui me permetrait de developper ma librairie dans les normes de la std;

    Pour l'instant quand j'inclus <iostream> ou tout autre partie de la librairie standard std cela me genere des erreurs de linkage qui sont celles ci:

    Code : S�lectionner tout - Visualiser dans une fen�tre � part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    1>------ Build started: Project: test_main, Configuration: Debug Win32 ------
    2>------ Build started: Project: AAI, Configuration: Debug Win32 ------
    2>Creating library...
    1>Linking...
    1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > & (__cdecl*)(class std::basic_ostream<char,struct std::char_traits<char> > &))" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z) already defined in AAI.lib(dev_ext.obj)
    2>Build log was saved at "file://c:\Documents and Settings\bebarbier\Mes documents\Visual Studio 2005\Projects\test_main\AAI\Debug\BuildLog.htm"
    2>AAI - 0 error(s), 0 warning(s)
    1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::endl(class std::basic_ostream<char,struct std::char_traits<char> > &)" (?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z) already defined in AAI.lib(dev_ext.obj)
    1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
    1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
    1>libcpmtd.lib(xmutex.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP80D.dll)
    1>libcpmtd.lib(xmutex.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP80D.dll)
    1>libcpmtd.lib(xdebug.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in msvcprtd.lib(MSVCP80D.dll)
    1>libcpmtd.lib(xdebug.obj) : error LNK2005: "struct std::_DebugHeapTag_t const & __cdecl std::_DebugHeapTag_func(void)" (?_DebugHeapTag_func@std@@YAABU_DebugHeapTag_t@1@XZ) already defined in msvcprtd.lib(MSVCP80D.dll)
    1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
    1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
    1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
    1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
    1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
    1>LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR80D.dll)
    1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
    1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
    1>C:\Documents and Settings\bebarbier\Mes documents\Visual Studio 2005\Projects\test_main\Debug\test_main.exe : fatal error LNK1169: one or more multiply defined symbols found
    1>Build log was saved at "file://c:\Documents and Settings\bebarbier\Mes documents\Visual Studio 2005\Projects\test_main\test_main\Debug\BuildLog.htm"
    1>test_main - 37 error(s), 2 warning(s)
    ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    serait ce une option manqu�e dans les propri�t�s du projet qui cree la librairie ?
    ou une macro oubli� avant l'include ? :

    .h utilis� dans me librairie
    Code : S�lectionner tout - Visualiser dans une fen�tre � part
    1
    2
    3
    4
    #pragma once
     
    #include <iostream>
    using namespace std;

  6. #6
    r0d
    r0d est actuellement connect�
    Membre exp�riment�

    Homme Profil pro
    D�veloppeur informatique
    Inscrit en
    Ao�t 2004
    Messages
    4 299
    D�tails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rh�ne Alpes)

    Informations professionnelles :
    Activit� : D�veloppeur informatique

    Informations forums :
    Inscription : Ao�t 2004
    Messages : 4 299
    Billets dans le blog
    2
    Par d�faut
    Il ne faut jamais faire un "using namespace" dans un .h. Il faut utiliser explicitement l'espace de nommage:
    Code : S�lectionner tout - Visualiser dans une fen�tre � part
    std::cout << "toto" << std::endl;
    Mais je ne suis pas certain que ton erreur vienne de l�.
    Pourrais-tu nous donner plus de pr�cisions?

+ R�pondre � la discussion
Cette discussion est r�solue.

Discussions similaires

  1. [Zip] Cr�ation d'un fichier zip avec zip.lib.php corrompue
    Par fdthierry dans le forum Biblioth�ques et frameworks
    R�ponses: 8
    Dernier message: 02/06/2008, 14h01
  2. R�ponses: 3
    Dernier message: 07/04/2006, 11h27
  3. R�ponses: 4
    Dernier message: 20/07/2004, 21h53
  4. R�ponses: 2
    Dernier message: 26/05/2003, 19h42
  5. [Kylix] [BCB] pb avec la STL
    Par pykoon dans le forum EDI
    R�ponses: 1
    Dernier message: 29/12/2002, 12h56

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo