Im trying to get Mono and Gtk# working on Windows.
When i try to run mcs hello.cs -r:"C:\Program Files (x86)\Mono\lib\gtk-sharp-2.0\gtk-sharp.dll"
i get the following error:
hello.cs(11,9): error CS0012: The type Atk.Implementor' is defined in an assemb ly that is not referenced. Consider adding a reference to assemblyatk-sharp, V ersion=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' C:\Program Files (x86)\Mono\lib\gtk-sharp-2.0\gtk-sharp.dll (Location of the sym bol related to previous error) hello.cs(11,9): error CS0012: The type GLib.IWrapper' is defined in an assembly that is not referenced. Consider adding a reference to assemblyglib-sharp, Ve rsion=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f' C:\Program Files (x86)\Mono\lib\gtk-sharp-2.0\gtk-sharp.dll (Location of the sym bol related to previous error) Compilation failed: 2 error(s), 0 warnings
This is my hello.cs:
using Gtk;
using System;
class Hello
{
static void Main ()
{
Application.Init ();
Window window = new Window ("Hello Mono World");
window.Show ();
Application.Run ();
}
}
When i try to run: (as shown in the tutorial) i get the following error:
Package gtk-sharp.2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk-sharp.2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk-sharp.2.0' found error CS8027: Error running pkg-config. Check the above output.
I didnt find anything on the net, can someone help?
Thank you!
Ok, the Problem seems to be that the mcs commandline Option -pkg:gtk-sharp-2.0 is not working under Windows, under Ubuntu it works fine.
In the pkg-config path there is the needed file gtk-sharp-2.0.pc, if i run pkg-configure it also finds the gtk-sharp package.
If anyone knows how to fix this Problem in Windows, it would be nice.
For all who run into the same Problem as me, add all needed dll's to the mcs by the -r option:
mcs hello.cs -r:"C:\Program Files (x86)\Mono\lib\gtk-sharp-2.0
\gtk-sharp.dll" -r:"C:\Program Files (x86)\Mono\lib\gtk-sharp-2.0\atk-sharp.dll"
-r:"C:\Program Files (x86)\Mono\lib\gtk-sharp-2.0\glib-sharp.dll"
Also have difficulties on this one.
Seems that pkg-config knows the package.
If I run"C:\Program Files (x86)\Mono\bin\pkg-config.exe" --list-all
it returns a list and there I can see gtk-sharp-2.0.
One thing I did find, is that the windows version of pkg-config doesn't just return 0 or 1, if you ask if the package is found.
So running
"C:\Program Files (x86)\Mono\bin\pkg-config.exe" --exists gtk-sharp-2.0
returns noting, but when you look at %ERRORLEVEL%, it is correct So running
echo %ERRORLEVEL%
returns the correct value "0".
So probably the msc implementation on windows has some difficulties with this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With