The type or namespace name 'AddSubstract' could not be found

P

P

Sort of just starting out with C#. I started a winform project - just one
form - call it proj1. Then I added a class library project to this project
which I named AddSubstract and named a class in AddSubtract as Add_Subtract.
My Add_Subtract class has one method called Add

using System;
using System.Collections.Generic;
using System.Text;

namespace AddSubtract
{
public class Add_Subtract
{
public int Add(int i, int j)
{
return i + j;
}
}
}

I compiled this class library into a dll. Then in proj1 if I make a
referenct to AddSubtract I can do this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//using AddSubstract; -- commented out because won't compile otherwise

namespace proj1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
AddSubtract.Add_Subtract s = new AddSubtract.Add_Subtract();
int i, j, k;
i = 2;
j = 3;
k = s.Add(i, j);
Console.WriteLine(s.Add(i, j).ToString() + " k is:" +
k.ToString());
}
}
}

But if I uncomment

using AddSubtract;

proj1 no longer compiles and I get this error message

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

What do I need to do so that I can include

using AddSubtract;

namespace?

Thanks,
P
 
J

Jeff Johnson

//using AddSubstract; -- commented out because won't compile otherwise

If this is your ACTUAL code then you have made a typo: there should be no
"s" after the "b".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top