Thread: Arhg, stupid syntax error, am I misusing make_pair?

  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968

    Arhg, stupid syntax error, am I misusing make_pair?

    The code

    Code:
    template < typename resource_t >
    void Manager<resource_t>::Add_To_List(const std::string & Filename, resource_t *)
    {
    	Resources.insert( std::make_pair( Filename , resource_t *) );
    }

    And the error
    Code:
    --------------------Configuration: Resource_Manager - Win32 Debug--------------------
    Compiling...
    Resource_Manager.cpp
    C:\Documents and Settings\colemanjon\Desktop\Resource_Manager 1\Resource_Manager.cpp(70) : error C2059: syntax error : ')'
            c:\program files\microsoft visual studio\vc98\include\xmemory(59) : while compiling class-template member function 'void __thiscall Manager<class MS3DModel>::Add_To_List(const class std::basic_string<char,struct std::char_traits<char>,class 
    std::allocator<char> > &,class MS3DModel *)'
    Error executing cl.exe.
    Creating browse info file...
    
    Resource_Manager.exe - 1 error(s), 0 warning(s)
    This is like, the last function that is causing my resource_system to be incomplete, please help!
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >void Manager<resource_t>::Add_To_List(const std::string & Filename, resource_t *)
    You didn't give "resource_t *" a variable name. Then change make_pair to use this name.

  3. #3
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    so setup a variable or struct or whatever that can be set equal to make_pair,

    then pass that?

    Let me add the function declaration just in case that is the problem..

    Code:
    	void Add_To_List( const std::string & Filename, resource_t* );
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    No look closely:
    >void Manager<resource_t>::Add_To_List(const std::string & Filename, resource_t *)

    >resource_t *
    See this. You have a type definition, but where's the name of the variable? For example:
    Code:
    void Manager<resource_t>::Add_To_List(const std::string & Filename, resource_t *Resource)
    Last edited by swoopy; 01-26-2006 at 09:59 AM.

  5. #5
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Thanks alot, that was it.. Silly me

    I figured its type would just be whatever I templated in the declaration of the manager

    Manager<MS3DModel> Models;

    I thought it would automatically take the form of an MS3DModel...
    Last edited by Shamino; 01-26-2006 at 10:56 AM.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM