maths soso
maths soso

Reputation: 51

Compile gtkmm program with command line?

I'm trying to run a gtkmm program in windows 10, I get errors when I compile even though I followed exactly the steps provided by the link attached below.

I installed MSYS2, I run all the commands and installed all the required packages using the pacman command (I followed this).

An example of a program:

#include <gtkmm.h>

int main(int argc, char *argv[])
{
  auto app =
    Gtk::Application::create(argc, argv,
      "org.gtkmm.examples.base");

  Gtk::Window window;
  window.set_default_size(200, 200);

  return app->run(window);
}

Error messages when executing with the command line (found here):

g++ simple.cc -o simple `pkg-config gtkmm-3.0 --cflags --libs` 

I get these errors:

C:\Users\sofiane\Desktop>g++ simple.cc -o simple `pkg-config gtkmm-3.0 --cflags --libs`
g++: error: `pkg-config: No such file or directory
g++: error: gtkmm-3.0: No such file or directory
g++: error: unrecognized command line option '--cflags'
g++: error: unrecognized command line option '--libs`'

Upvotes: 2

Views: 843

Answers (1)

ptomato
ptomato

Reputation: 57854

It seems that your shell does not understand backticks, and is considering them part of the command, making it look for a nonexistent program called `pkg-config. The backticks signify that the output of the pkg-config program should be used in the command line.

You might be using the regular command prompt instead of the MSYS shell. Try to open an MSYS shell window, or use this workaround:

C:\Users\sofiane\Desktop> pkg-config gtkmm-3.0 --cflags --libs
-Ithis -Ithat -lsomething (copy and paste this line)
C:\Users\sofiane\Desktop> g++ simple.cc -o simple -Ithis -Ithat -lsomething (paste here)

Upvotes: 3

Related Questions