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 C3618

Error Message

'function': a method marked DllImport cannot be defined

A method marked with DllImportAttribute is defined in the specified.DLL.


The following sample generates C3618.

// C3618.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Runtime::InteropServices;

[ DllImport("user32.dll", EntryPoint="MessageBox", CharSet=CharSet::Ansi) ]  // CHANGED 
void Func(); 

void Func() {}   // C3618, remove this function definition to resolve

Community Additions

© 2015 Microsoft