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 8690821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:59:16+00:00 2026-06-12T23:59:16+00:00

I have the following C++/CLI snippet: .h #pragma unmanaged #include <vector> public delegate std::vector<std::wstring>

  • 0

I have the following C++/CLI snippet:

.h
#pragma unmanaged
#include <vector>

public delegate std::vector<std::wstring> XYZ(const std::wstring& filter);

.cpp

XYZ^ xyz = gcnew XYZ(&myClass::xyzFunc); // <-error C2065 + C2061

This case I get at this line two errors:

error C2065: ‘xyz’ : undeclared identifier

error C2061: syntax error : identifier ‘XYZ’

However, if I change the delegate return type from vector -> wstring (for example), it works!

public delegate std::wstring XYZ(const std::wstring& filter); // <-- w/o vector<> , works!

Has anyone any idea what is the problem?
Greatly appreciated!

  • 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-06-12T23:59:17+00:00Added an answer on June 12, 2026 at 11:59 pm

    Clearly this is a compiler defect, it should at least have emitted a diagnostic why it didn’t add the delegate type to the symbol table. You could submit it to connect.microsoft.com but they are not going to fix it.

    A workaround is to use a typedef to declare the return value type:

    typedef std::vector<std::wstring> returntype;
    delegate returntype XYZ(const std::wstring& filter);
    

    I would urge you a bit to treat C++/CLI as an interop language, its major reason for being. This delegate is not usable by any other managed code. Do favor String and List<String^> here.

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

Sidebar

Related Questions

I have the following code in a c++/CLI library to catch unmanaged exceptions and
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I have the following code: //Comp454 program 2 #include <iostream> #include <string> #include <fstream>
I have used the following code to create two threads: //header files #include <pthread.h>
I have the following table: CREATE table DataDiff (CLI tinyint, id tinyint, date datetime,
I have the following in C++/CLI: (take note of my errors in comments) class
I have the following code: <td class=select-cli-numbers><div class=explanationText style=cursor:pointer;>Click here to select numbers</div></td> which
I have the following: final String scriptName = new File(getClass().protectionDomain.codeSource.location.path).getName() final cli = new
I have the following three projects in my solution: 1. C# library 2. C++/CLI
I have the following function: public void Test(IDataContext context) { return (From c In

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.