0

I need C# help from the experts out there. I'm running my programs command line on Ubuntu. I have two Class files , Class A and Class B and I am trying to use Class A inside of Class B. I tried using the same namespace for both of them and including Class B in the header of Class A with my include System.xxx tags but I'm getting the following:

"TdFMain.cs(26,26): error CS0246: The type or namespace name `Biker' could not be found. Are you missing an assembly reference?"

Does anyone know how I can get these two files working together? Thanks in advance,

eduardo
  • 3
  • 3

1 Answers1

1

You need to compile them together in a single turn:

gmcs <yourOptions> ClassA.cs ClassB.cs

The other option is to create a class library (.dll) from ClassA and include it when compiling ClassB:

gmcs <yourOptions> -r ClassA.dll ClassB.cs
Psi
  • 6,387
  • 3
  • 16
  • 26
  • how did you know the OP is using compiler called gmcs? – Lei Yang Mar 06 '17 at 07:58
  • Thank you so much! What is the difference between gmcs and mcs ? Because I currently use mcs. – eduardo Mar 06 '17 at 08:05
  • It is the same: http://www.mono-project.com/docs/about-mono/languages/csharp/ mcs just links to the latest version, so using mcs or gmcs makes no difference. It is even better to stick with mcs – Psi Mar 06 '17 at 08:09
  • @Psi thank you very much again. This little issue was driving me crazy! – eduardo Mar 06 '17 at 08:11
  • @Lei Yang: because he is compiling on ubuntu, so it must be mono, and then gmcs was just a close assumption. @ eduardo glad I could have helped – Psi Mar 06 '17 at 08:11
  • if csc is short for csharp compiler, what is gmcs short for? – Lei Yang Mar 06 '17 at 08:15
  • 1
    have a look here: http://stackoverflow.com/questions/26844595/what-does-the-d-in-dmcs-stand-for – Psi Mar 06 '17 at 08:21