Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. a error i can't understand

a error i can't understand

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsstutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    muddog
    wrote on last edited by
    #1

    code: std::map amap; char str[]; amap.find(str); // compiler point error to here error: error C2451: conditional expression of type 'class std::_Tree,struct std::map,class std::al locator >::_Kfn,struct std::less,class std::allocator >::iterator' is illegal No user-defined-conversion operator available that can perform this co nversion, or the operator cannot be called i don't know how to cope with it. please help me! thanks. love program

    J M 2 Replies Last reply
    0
    • M muddog

      code: std::map amap; char str[]; amap.find(str); // compiler point error to here error: error C2451: conditional expression of type 'class std::_Tree,struct std::map,class std::al locator >::_Kfn,struct std::less,class std::allocator >::iterator' is illegal No user-defined-conversion operator available that can perform this co nversion, or the operator cannot be called i don't know how to cope with it. please help me! thanks. love program

      J Offline
      J Offline
      Johnny
      wrote on last edited by
      #2

      Did you correctly include your code within your message, or did the angle brackets get chopped off? A map needs two template parameters, for example: std::map<int,string> This is the map key, and the map item. If you have done this then repost your code and escape the < and > (or check the 'do not treat <'s as HTML) and we can take another look.

      1 Reply Last reply
      0
      • M muddog

        code: std::map amap; char str[]; amap.find(str); // compiler point error to here error: error C2451: conditional expression of type 'class std::_Tree,struct std::map,class std::al locator >::_Kfn,struct std::less,class std::allocator >::iterator' is illegal No user-defined-conversion operator available that can perform this co nversion, or the operator cannot be called i don't know how to cope with it. please help me! thanks. love program

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        char str[] is not a legal variable declaration - you need to specify the array size. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.   -- Michael P. Butler in the Lounge

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups