2
votes

I'm trying to compile the "GTK# Hello World" example at http://mono-project.com/Mono_Basics in Windows 7 (64bits). I'm getting this error:

error CS8027: Couldn't run pkg-config: ApplicationName='pkg-config', CommandLine ='--libs gtk-sharp-2.0', CurrentDirectory=''

I have successfully compiled and run the "Console Hello World" example.

I have installed Mono-2.10.8.

Thanks in advance for your help

2
can you provide more details like compiler options. If you are using MonoDevelop to compile, than Monodevelop use MS .Net framework installed on machine.Sharique
Have you installed 'pkg-config'? That doesn't come with Windows out of the box.Daniel Fischer
I installed mono-2.10.8-gtksharp-2.12.11-win32-1.exe to compile. I'm compiling with "gmcs hellogtk.cs -pkg:gtk-sharp-2.0". I have pkg-config.exe in the Mono /bin folder. I tried to replace it with the last version found at gtk.org/download/win64.php, but I keep getting the same error.s_federici
In that case you should be able to compile it by adding Mono's folder to PATH. Or - just use the Mono Command Prompt which does it - and run your command in it.konrad.kruczynski
Following the suggestion I have run the Mono Command Prompt, but I keep ketting the same (or similar) error message: "error CS8027: Error running pkg-config. Check the above output."s_federici

2 Answers

3
votes

I tried to compile a GTK# example in a Windows 7 with Mono 2.10.8 and the options you used with the compiler, so i have the same error then i tried to reference each assembly by hand so it works fine.

Here is the full command, i tested in a Mono 2-10.8 comman prompt.

gmcs ButtonApp.cs -r:C:/PROGRA~2/MONO-2~1.8/lib/mono/gtk-sharp-2.0/pango-sharp.dll,C:/PROGRA~2/MONO-2~1.8/lib/mono/gtk-sharp-2.0/atk-sharp.dll,C:/PROGRA~2/MONO-2~1.8/lib/mono/gtk-sharp-2.0/gdk-sharp.dll,C:/PROGRA~2/MONO-2~1.8/lib/mono/gtk-sharp-2.0/gtk-sharp.dll

I hope this can helps

1
votes

You were trying to use pkg-config which you do not have. pkg-config with --libs turns specified packages (like gtk-sharp-2.0 in your case) into references to libraries. If you don't want to install pkg-config, you have two options:

  • manually reference needed libraries with compiler options;
  • create a project with these libraries referenced.

I recommend the second option, as compiling by specifying all sources and references directly could be good for hello-world examples, but not for the something bigger. You would make your own script to compile the project, so why not use something designed just for that - like xbuild or make. MonoDevelop should contain empty Gtk# project template.