Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 970403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:47:59+00:00 2026-05-16T02:47:59+00:00

I am trying to return a CArray from a function and trying to call

  • 0

I am trying to return a CArray from a function and trying to call the function from another class

short ListMaker::RetArray(CString szName, CArray<CString, CString&> &szarr_Names) {
    szarr_Names.Add(szName);
    return 0;
}
int main() {
    //..
    CArray<CString, CString&> myArray;
    ListMaker LM;
    short nCode = LM.RetArray(L"Name", myArray);
    //..
}

I am getting following errors:

Error   1   error C2664: 'RetArray' : cannot convert parameter 2 from 'CArray<TYPE,ARG_TYPE>' to 'CArray<TYPE,ARG_TYPE>'
Error   2   error C2511: 'short RetArray(CString,CArray<TYPE,ARG_TYPE> &)' : overloaded member function not found in 'ListMaker'

Please tell me the correct way to define and access the return value of the CArray.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:47:59+00:00Added an answer on May 16, 2026 at 2:47 am

    Erm, frist of all if RetArray is a member of ListMaker class and you call it from main(), you cannot call it like this: short nCode = RetArray(L"Name", myArray);

    If RetArray is a static member, use short nCode = ListMaker::RetArray(L"Name", myArray);. It it’s non-static, use instance, short nCode = listMakerInstance.RetArray(L"Name", myArray);.

    Check your header file for RetArray declaration in ListMaker class. It might differ from the implementation in your cpp file, hence you get the C2511 error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to return the value that a $ajax call returns, from a function
I'm trying to return a type from a fortran function. This is the code.
I have been trying to return an ARABIC string from a JNI call. The
I am trying to return the value by using unix_timestamp function but it behaves
I am trying to return two json sets from java which each contain key/value
i am trying to return a list of users whose accounts have expired from
Long story short, I'm trying to store corresponding data values from a JSON returning
$('#tabPublish').click(function(){ $('#columnRight').load('/pages/publish/'); tabArray.push({'linkId': 'tabPublish', 'id': 'columnRight','url': '/pages/publish/',}); return false; }); I'm trying to push
I'm trying to carry a change from a global variable over to another module
Im trying to return a SimpleQuery list that queries a single table and uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.