Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Unable to use Managed C++ dll

$
0
0

Using VS 2010 I created a small C# Console app that does nothing. I also created a managed C++ dll (called "steven") with a single method that just returns. I added a reference to the Managed dll into the C# Console app. No problem.

Now, when I type "using steven" in my C# app, it fails to compile. The error is:

The type or namespace name 'steven' could not be found (are you missing a using directive or an assembly reference?)

Code is attached. Any thoughts on this?

Steven

// steven.h
#pragma once
using namespace System;

namespace steven
{
	public ref class Class1
	{
	public:
		void DoSomething();
	};
}


// steven.cpp
// This is the main DLL file.

#include "stdafx.h"
#include "steven.h"

namespace steven
{
	void Class1::DoSomething()
	{
	}
}

// Program.cs
using System;
using System.Collections.Generic;
using System.Text;
using steven; // THIS LINE SHOWS THE ERROR MESSAGE

namespace ConsoleApplication1
{
	class Program
	{
		static void Main(string[] args)
		{
		}
	}
}


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>