Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C3374

Error Message

can't take address of 'function' unless creating delegate instance

The address of a function was taken in a context other than the creation of a delegate instance.

The following sample generates C3374:

// C3374.cpp
// compile with: /clr
public delegate void MyDel(int i);

ref class A {
   void func1(int i) {
      System::Console::WriteLine("in func1 {0}", i);

int main() {
   &A::func1;   // C3374

   // OK
   A ^ a = gcnew A;
   MyDel ^ StaticDelInst = gcnew MyDel(a, &A::func1);

Community Additions

© 2015 Microsoft