none
problem with std::map error LNK2019 RRS feed

  • Question

  • Hello, i make a little project using sdl+opengl and i get a linking error i can't resolve:
    Linking...
    edition.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in ....
    It happen when i use a map<string, string> (when i comment the line, no more error...)

    Code : C++

    #ifndef _EDITION_H
    #define _EDITION_H

    #include <map>
    #include <fstream>
    #include <string>
    #include "singleton.h"
    usingnamespace std;

    typedef map<string, string> ms; //while commented, no error

    class Edition : public Singleton<Edition>
    {
            friend Singleton<Edition>;

    public:
            string getPropriete(string id);
            void Load(constchar *edition);
           

    private:
            Edition();

            string name;
            int symbole;
            double conversion;
            ms cases;

    };
           
    #endif //_EDITION_H

    On other forums, i found responses saying me to change from /MD to /MDd removing or not msvcrt.lib, but nothing better happen...

    Linking error:

    edition.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,0> >::const_iterator::operator==(class std::_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,0> >::const_iterator const &)const "(??8const_iterator@?$_Tree@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@$0A@@std@@@std@@QBE_NABV012@@Z)
    D:\visual_projects\test\Debug\test.exe : fatal error LNK1120: 1 unresolved externals


    In case you would need singleton class:

    Code : C++
    /*
    allow singleton instanciation
    */

    #pragma once
    #include <stdio.h>

    template <typename T>
    class Singleton
    {
    public:
        /*return 1 reference on the singleton, if no one existe, create one*/
        static T* Instance()
        {
            if(m_instance == NULL) m_instance = new T;
            return m_instance;
        };

        //destroy instance
        staticvoid DestroyInstance()
        {
            delete m_instance;
            m_instance = NULL;
        };
    protected:
        //constructeur
        Singleton()
        {
        };

        //Destructeur
        virtual ~Singleton()
        {
        };

    private:
        //copy constructor
        Singleton(const Singleton& source)
        {
        };

        static T* m_instance; // instance
    };

    //initialisation
    template <typename T> T* Singleton<T>::m_instance = NULL;
    mardi 20 mars 2007 20:10