View Full Version : Namespce does not exists

March 13th, 2008, 03:49 AM
I have a little problem...
I am learning C# 2005 on Mono 1.2.6 and MD .18 Beta. It gives me this error when I try to compile this example.

mcs Main.cs
Main.cs(2,7): error CS0234: The type or namespace name `Generic' does not exist in the namespace `System.Collections'. Are you missing an assembly reference?
Main.cs(2,1): error CS0246: The type or namespace name `Collections.Generic' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 2 error(s), 0 warnings

The actual cod is here

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

namespace SymbolicConstants
class SymbolicConstants
static void Main(string[] args)
const int FreezingPoint = 32; // degrees Fahrenheit
const int BoilingPoint = 212;

System.Console.WriteLine("Freezing point of water: {0}",
System.Console.WriteLine("Boiling point of water: {0}",

BoilingPoint = 21;


I tried the Mono Class Library, it shows that System. Collections.Generic is there in .NET 2. Why the compiler is giving error. Is there any other one to use like 'gmcs'?

March 13th, 2008, 08:27 PM
Try Installing The G++ Package

Open A Terminal And Type:

apt-get update


apt-get install g++

Hope This Helps You!!!

March 13th, 2008, 09:27 PM
It appears that Mono supports generics based on this:

maybe you have the old version of Mono?

Mono is not a perfect implementation of C# and some things don't work on it.

If you don't absolutely need C# I really recommend learning Java instead, it is 100% complete on every operating system. It is roughly equivalent to C#. Sometimes I think of C# as a proprietary revamping of Java. C# is Microsoft's answer to Java and also their attempt to lock it down.

Also, C# was only ever meant to run on Windows so it will never be quite right on Linux. Mono will always lag behind the Microsoft C# version.

If you still want to learn C# though I wish you the best. It's not a bad language, I use it at work for some projects that require it. Mainly for plugins to another application that can only be written in C#.

March 13th, 2008, 09:30 PM
Are you using mcs, gmcs or smcs?

That site says mcs is .Net 1.1 which didn't have generics.

Try using one of the others. smcs is the newest one.

March 17th, 2008, 04:20 AM
Problem solved by using gmcs.

June 5th, 2008, 09:16 AM
i am having the same problem
however, it doesnt solve with gmcs.
what should i do?
pls help

June 9th, 2008, 08:00 AM
there are three compilers gmcs, smcs and mcs,
What version of C# you are targetting?