✅ Namespace error
The type or namespace name 'Game' does not exist in the namespace 'Rhythm_Flow' (are you missing an assembly reference?)
Anyone know why i am getting this error?
47 Replies
Because the Game class doesn't exist in that Rythom Namespace, it might be in another namespace
More likely it does exist in the
Rythm_Flow
namespace but your using
statement is incorrect
Try removing the using Rythm_Flow.Game;
lineYeah possible
I'm assuming your
Game
class is defined in namespace Rythm.Flow
as wellMaybe just try
using Rythom_Flow;
you're already in that namespace
Yeah but just in case
@DevLop games are you coming from a python background perchance?
Why?
I mean yea but why?
I stil get the same error
Can you show your
Game
class
Or fileSo it's clear that it's defined in the OpenTKWindow namespace not in that Rythom Namespace
try
using OpenTKWindow;
or
using OpenTKWindow.Game;
Former should work fineSame error
Can you share the line the error is being reported on?
Screenshot of the error would be helpful
This is the error
using (Game game = new Game())
Are you using Visual Studio?
No vs code
Did you replace
using Rhythm_Flow.Game;
with using OpenTKWindow;
?
Does putting the cursor onto the line and using ctrl+.
show you any recommendations?It still gave errors
The same error?
Are there multiple errors now?
There's only one
Alright, and adding
using OpenTKWindow;
to the using
s doesn't help?no
ctrl+.
on the Game game = Game()
doesn't show help?Nothing related to using a namespace from a different file
files/paths are not relevant to the problem, it's all determined by namespace/class names
C# doesn't care about file names or paths like that
This whole thing is confusing
You can think of namespaces as "virtual" folders to the compiler
so if you have two classes defined in the same namespace, they can see each other no problem
but if they are in different namespaces, you need to tell the compiler where to find them using
using
statements
@DevLop games try this out and see if it works
And since your
Game
class is in a different namespace than the Program
class, you need to add the using
statement that tells the compiler where to look for Game
when processing your Program
class
basically, thisSame error
what error
maybe clean your project or restart VS
wdym clean
aight forget that for now, trying restarting the VS and see
Now it see my namespace
good
Now question
Why did it detect my namespace when i restarted vs code?
it's buggy sometimes
intelisence bug
or cache problem
or whatever
sometimes I save my time by doing compilation manually with terminal
Wait so i had it right? I just needed a restart...
That fixes it?
no, that's ignore it
k
$close
If you have no further questions, please use /close to mark the forum thread as answered