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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Beginner with C++ - Need helps with overload member function error

Beginner with C++ - Need helps with overload member function error

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comquestionlearning
6 Posts 4 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.
  • L Offline
    L Offline
    LongDuyTran
    wrote on last edited by
    #1

    I'm trying to do programming C++ for my project. I got into trouble when I tried to do program for communicating with COM port(reading information in ComboBox). The error " overloaded member function 'class CString(class CComboBox &a) not found in 'CXeedlg'. Could someone help me to overcome ? overloaded member function not found in 'class' The following is my code: " CString getCurStrInComboBox(const CComboBox &a) { CString str; a.getLBText(a.GetCurSel(),str); return str; } " And the 2nd one is I dont know the reason why the complier informed that InsertString, AddString, GetCursel() arent members of ComboBox. The deadline for my project is coming soon so I will really appreciate all your helps. Thank you very much

    C S 2 Replies Last reply
    0
    • L LongDuyTran

      I'm trying to do programming C++ for my project. I got into trouble when I tried to do program for communicating with COM port(reading information in ComboBox). The error " overloaded member function 'class CString(class CComboBox &a) not found in 'CXeedlg'. Could someone help me to overcome ? overloaded member function not found in 'class' The following is my code: " CString getCurStrInComboBox(const CComboBox &a) { CString str; a.getLBText(a.GetCurSel(),str); return str; } " And the 2nd one is I dont know the reason why the complier informed that InsertString, AddString, GetCursel() arent members of ComboBox. The deadline for my project is coming soon so I will really appreciate all your helps. Thank you very much

      C Offline
      C Offline
      Chuck OToole
      wrote on last edited by
      #2

      Don't you need a class name in front of that function? As in, CXeedlg::getCurStrInComboBox

      L 1 Reply Last reply
      0
      • L LongDuyTran

        I'm trying to do programming C++ for my project. I got into trouble when I tried to do program for communicating with COM port(reading information in ComboBox). The error " overloaded member function 'class CString(class CComboBox &a) not found in 'CXeedlg'. Could someone help me to overcome ? overloaded member function not found in 'class' The following is my code: " CString getCurStrInComboBox(const CComboBox &a) { CString str; a.getLBText(a.GetCurSel(),str); return str; } " And the 2nd one is I dont know the reason why the complier informed that InsertString, AddString, GetCursel() arent members of ComboBox. The deadline for my project is coming soon so I will really appreciate all your helps. Thank you very much

        S Offline
        S Offline
        Stefan_Lang
        wrote on last edited by
        #3

        First: The member function listed in the compiler message looks like a conversion constructor for the class CString, taking a parameter of type CComboBox. Apparently the compiler found a function call somewhere in your code that requires a parameter of type CString, but you passed it a parameter of type CComboBox. Therefore it tried to find a conversion function from CComboBox to CString, and because it didn't find one, it issued this error message. Solution: locate the position in your code that the error message points to and replace the CComboBox argument with one of type String, or convertible to CString. (P.S.: the error message looks like there's something missing - it might just be what Chuck said) Second: This might be a followup error, but I cannot fathom how. You might have forgotten to include the right header, but I doubt that - it would cause quite a lot more errors, and the compiler wouldn't even recognize the symbol CComboBox to be a class. Maybe you mistyped the type CComboBox for ComboBox, like you did in your posting? It might be helpful to see a piece of code that these error messages point to.

        1 Reply Last reply
        0
        • C Chuck OToole

          Don't you need a class name in front of that function? As in, CXeedlg::getCurStrInComboBox

          L Offline
          L Offline
          LongDuyTran
          wrote on last edited by
          #4

          That was my bad in typing. I also have that part. I also wanna ask you guys more questions. "void CXbeefixedDlg::InitComboBox() { // ComboBox ComPort m_cboComport.ResetContent(); m_cboComport.AddString("COM1"); m_cboComport.AddString("COM2"); m_cboComport.AddString("COM3"); m_cboComport.AddString("COM4"); m_cboComport.SetCurSel(2); // ComboBox BitRate m_cboBitrate.ResetContent(); m_cboBitrate.InsertString(0,"1200"); m_cboBitrate.InsertString(1,"2400"); m_cboBitrate.InsertString(2,"4800"); m_cboBitrate.InsertString(3,"9600"); m_cboBitrate.InsertString(4,"19200"); m_cboBitrate.InsertString(5,"38400"); m_cboBitrate.InsertString(6,"57600"); m_cboBitrate.InsertString(7,"115200"); m_cboBitrate.InsertString(8,"230400"); m_cboBitrate.SetCursel(3); // Combobox Databit m_cboDatabits.ResetContent(); m_cboDatabits.AddString("4"); m_cboDatabits.AddString("5"); m_cboDatabits.AddString("6"); m_cboDatabits.AddString("7"); m_cboDatabits.AddString("8"); m_cboDatabits.SetCurSel(0); //Combox Stopbit m_cboStopbits.ResetContent(); m_cboStopbits.AddString("1"); m_cboStopbits.AddString("1.5"); m_cboStopbits.AddString("2"); m_cboStopbits.SetCurSel(0); //Combox Paritybit m_cboParitybit.ResetContent(); m_cboParitybit.InsertSring(0,"None"); m_cboParitybit.InsertString(1,"Odd"); m_cboParitybit.InsertString(2,"Even"); m_cboParitybit.InsertString(3,"Mark"); m_cboParitybit.InsertString(4,"Space"); m_cboParitybit.SetCursel(0); } void CXbeefixedDlg::Settings() { // Check whether port was openned, Close port to setup parameter if (m_mscomm.SetPortOpen()) m_mscomm.SetPortOpen(false); // Initialize Port name m_mscomm.SetCommPort(m_cboComport.GetCursel()+1); // Initialize parameters, databits, stopbits, parity bits, flowcontrol CString strBitrate = getCurStrInCombobox(m_cboBitrate); CString strParitybit = getCurStrInCombobox(m_cboParitybit); CString strStopbits = getCurStrInCombobox(m_cboStopbits); CString strDatabits = getCurStrInCombobox(m_cboDatabits); //Cstring strflowcontrol = getCurStrInCombobox(m_FlowControl); CString strSetting; strSetting.Format("%s,%c.%s,%s",strBitrate,strParitybit[1],strStopbits,strDatabits); m_mscomm.SetSettings(strSetting); // Other initializations m_mscomm.SetRThreshold(1); m_mscomm.SetInputlen(2); // Read 2 characters per once time m_mscomm.SetInputBufferSize(1024); m_mscomm.SetInputMode(0); // 0 - Text mode, 1 - Binary Mode m_mscomm.SetPortOpen(true); // Open COM port }

          C K 2 Replies Last reply
          0
          • L LongDuyTran

            That was my bad in typing. I also have that part. I also wanna ask you guys more questions. "void CXbeefixedDlg::InitComboBox() { // ComboBox ComPort m_cboComport.ResetContent(); m_cboComport.AddString("COM1"); m_cboComport.AddString("COM2"); m_cboComport.AddString("COM3"); m_cboComport.AddString("COM4"); m_cboComport.SetCurSel(2); // ComboBox BitRate m_cboBitrate.ResetContent(); m_cboBitrate.InsertString(0,"1200"); m_cboBitrate.InsertString(1,"2400"); m_cboBitrate.InsertString(2,"4800"); m_cboBitrate.InsertString(3,"9600"); m_cboBitrate.InsertString(4,"19200"); m_cboBitrate.InsertString(5,"38400"); m_cboBitrate.InsertString(6,"57600"); m_cboBitrate.InsertString(7,"115200"); m_cboBitrate.InsertString(8,"230400"); m_cboBitrate.SetCursel(3); // Combobox Databit m_cboDatabits.ResetContent(); m_cboDatabits.AddString("4"); m_cboDatabits.AddString("5"); m_cboDatabits.AddString("6"); m_cboDatabits.AddString("7"); m_cboDatabits.AddString("8"); m_cboDatabits.SetCurSel(0); //Combox Stopbit m_cboStopbits.ResetContent(); m_cboStopbits.AddString("1"); m_cboStopbits.AddString("1.5"); m_cboStopbits.AddString("2"); m_cboStopbits.SetCurSel(0); //Combox Paritybit m_cboParitybit.ResetContent(); m_cboParitybit.InsertSring(0,"None"); m_cboParitybit.InsertString(1,"Odd"); m_cboParitybit.InsertString(2,"Even"); m_cboParitybit.InsertString(3,"Mark"); m_cboParitybit.InsertString(4,"Space"); m_cboParitybit.SetCursel(0); } void CXbeefixedDlg::Settings() { // Check whether port was openned, Close port to setup parameter if (m_mscomm.SetPortOpen()) m_mscomm.SetPortOpen(false); // Initialize Port name m_mscomm.SetCommPort(m_cboComport.GetCursel()+1); // Initialize parameters, databits, stopbits, parity bits, flowcontrol CString strBitrate = getCurStrInCombobox(m_cboBitrate); CString strParitybit = getCurStrInCombobox(m_cboParitybit); CString strStopbits = getCurStrInCombobox(m_cboStopbits); CString strDatabits = getCurStrInCombobox(m_cboDatabits); //Cstring strflowcontrol = getCurStrInCombobox(m_FlowControl); CString strSetting; strSetting.Format("%s,%c.%s,%s",strBitrate,strParitybit[1],strStopbits,strDatabits); m_mscomm.SetSettings(strSetting); // Other initializations m_mscomm.SetRThreshold(1); m_mscomm.SetInputlen(2); // Read 2 characters per once time m_mscomm.SetInputBufferSize(1024); m_mscomm.SetInputMode(0); // 0 - Text mode, 1 - Binary Mode m_mscomm.SetPortOpen(true); // Open COM port }

            C Offline
            C Offline
            Chuck OToole
            wrote on last edited by
            #5

            is this in your code or is this more "typo" during entry:

            Quote:

            CComBoBox

            you have too many capital "B"s in your CComboBox :)

            1 Reply Last reply
            0
            • L LongDuyTran

              That was my bad in typing. I also have that part. I also wanna ask you guys more questions. "void CXbeefixedDlg::InitComboBox() { // ComboBox ComPort m_cboComport.ResetContent(); m_cboComport.AddString("COM1"); m_cboComport.AddString("COM2"); m_cboComport.AddString("COM3"); m_cboComport.AddString("COM4"); m_cboComport.SetCurSel(2); // ComboBox BitRate m_cboBitrate.ResetContent(); m_cboBitrate.InsertString(0,"1200"); m_cboBitrate.InsertString(1,"2400"); m_cboBitrate.InsertString(2,"4800"); m_cboBitrate.InsertString(3,"9600"); m_cboBitrate.InsertString(4,"19200"); m_cboBitrate.InsertString(5,"38400"); m_cboBitrate.InsertString(6,"57600"); m_cboBitrate.InsertString(7,"115200"); m_cboBitrate.InsertString(8,"230400"); m_cboBitrate.SetCursel(3); // Combobox Databit m_cboDatabits.ResetContent(); m_cboDatabits.AddString("4"); m_cboDatabits.AddString("5"); m_cboDatabits.AddString("6"); m_cboDatabits.AddString("7"); m_cboDatabits.AddString("8"); m_cboDatabits.SetCurSel(0); //Combox Stopbit m_cboStopbits.ResetContent(); m_cboStopbits.AddString("1"); m_cboStopbits.AddString("1.5"); m_cboStopbits.AddString("2"); m_cboStopbits.SetCurSel(0); //Combox Paritybit m_cboParitybit.ResetContent(); m_cboParitybit.InsertSring(0,"None"); m_cboParitybit.InsertString(1,"Odd"); m_cboParitybit.InsertString(2,"Even"); m_cboParitybit.InsertString(3,"Mark"); m_cboParitybit.InsertString(4,"Space"); m_cboParitybit.SetCursel(0); } void CXbeefixedDlg::Settings() { // Check whether port was openned, Close port to setup parameter if (m_mscomm.SetPortOpen()) m_mscomm.SetPortOpen(false); // Initialize Port name m_mscomm.SetCommPort(m_cboComport.GetCursel()+1); // Initialize parameters, databits, stopbits, parity bits, flowcontrol CString strBitrate = getCurStrInCombobox(m_cboBitrate); CString strParitybit = getCurStrInCombobox(m_cboParitybit); CString strStopbits = getCurStrInCombobox(m_cboStopbits); CString strDatabits = getCurStrInCombobox(m_cboDatabits); //Cstring strflowcontrol = getCurStrInCombobox(m_FlowControl); CString strSetting; strSetting.Format("%s,%c.%s,%s",strBitrate,strParitybit[1],strStopbits,strDatabits); m_mscomm.SetSettings(strSetting); // Other initializations m_mscomm.SetRThreshold(1); m_mscomm.SetInputlen(2); // Read 2 characters per once time m_mscomm.SetInputBufferSize(1024); m_mscomm.SetInputMode(0); // 0 - Text mode, 1 - Binary Mode m_mscomm.SetPortOpen(true); // Open COM port }

              K Offline
              K Offline
              krmed
              wrote on last edited by
              #6

              Most likely, this is your problem:

              CString CXbeefixedDlg::getCurStrInCombobox(const CComBoBox &a)

              Instead of CComBoBox, it should be CComboBox Hope that helps.

              Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

              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