Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 578959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:18:56+00:00 2026-05-13T14:18:56+00:00

Can someone please help me with compiling gtk+ (& gtkmm) at Vista cmd prompt?

  • 0

Can someone please help me with compiling gtk+ (& gtkmm) at Vista cmd prompt?
I have tried recently & cannot get this to work. I feel I have all dependencies and paths correct but I obviously haven’t or am missing something! I have searched the internet but haven’t found specific help for this (I am also trying to compile in cygwin- but have successfully compiled & run the simple helloworld gtk+ example in MSYS).

I have gcc installed via MinGW & Gtk+ Win32 dev (Glade) & Gtkmm Win32 installed. Here are some sample cmd prompt outputs to show the problems I am getting:

D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>gcc helloworld.c -o hellowo
rld
helloworld.c:1:21: gtk/gtk.h: No such file or directory
helloworld.c:5: error: syntax error before '*' token
helloworld.c:11: error: syntax error before "delete_event"
helloworld.c:11: error: syntax error before '*' token
helloworld.c: In function `delete_event':
helloworld.c:26: error: `TRUE' undeclared (first use in this function)
helloworld.c:26: error: (Each undeclared identifier is reported only once
helloworld.c:26: error: for each function it appears in.)
helloworld.c: At top level:
helloworld.c:30: error: syntax error before '*' token
helloworld.c: In function `main':
helloworld.c:40: error: `GtkWidget' undeclared (first use in this function)
helloworld.c:40: error: `window' undeclared (first use in this function)
helloworld.c:41: error: `button' undeclared (first use in this function)
helloworld.c:48: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this func
tion)
helloworld.c:56: error: `NULL' undeclared (first use in this function)
helloworld.c:80: error: `gtk_widget_destroy' undeclared (first use in this funct
ion)

D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>gcc helloworld.c -o hellowo
rld pkg-config --cflags --libs gtk+-2.0
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
cc1.exe: error: unrecognized command line option "-fcflags"
cc1.exe: error: unrecognized command line option "-flibs"

D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>gcc --v
Reading specs from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi
th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis
able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d
isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with
out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl
e-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)

D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>pkg-config --version
0.23

D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>which pkg-config
/cygdrive/c/Gtk+/bin/pkg-config

D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld> echo %PKG_CONFIG_PATH%
C:\Gtk+\lib\pkgconfig

Is pkg-config installed alright? Am I using the correct compile command syntax?
Can I use MS vis C express compiler (or whatever MSWindows7 SDK compiler is-as I also have that installed?!). I am only a beginner/amateur programmer but do want to write gtk+/gtkmm code for GUI programming and would like to be able compile at cmd prompt as well as using IDEs for coding & compiling/running.

I am grateful for and look forward to helpful replies, many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:18:56+00:00Added an answer on May 13, 2026 at 2:18 pm

    Using pkg-config from cmd.exe is really a pain, as the “normal” way to use it is inside backquotes or backticks (the `thingies, ASCII backquote, don’t call them “backslashes”) in a Unix style shell. If you insist on using just cmd.exe, you need to do some cmd.exe acrobatics to get the output of pkg-config into the command line. Or just run pkg-config manfually and copy/paste its output into a .bat file that does the build.

    Anyway, one important thing to remember is that whenever you see the unfortunately common meme of running pkg-config with both the –cflags and –libs options at the same time (as in LiraNuna’s answer above), that in general won’t work on Windows.

    The order of arguments given to gcc (and cl, for that matter) is important. Libraries should go after the object (or source) files that reference them.

    (It just happens to usually work on Linux and other ELF-based systems to do it randomly because executables there can contain undefined symbols.)

    So if you have the output of pkg-config –cflags foo in the env var FOO_CFLAGS, and the output of pkg-config –libs foo in the env var FOO_LIBS, the correct way to run gcc would be

    gcc %CFLAGS% -o myprog.exe %FOO_CFLAGS% myprog.c %FOO_LIBS% %LIBS%
    

    where CFLAGS are whatever other compiler flags you want to use and LIBS whatever other libraries you need. Add more source or object files as needed, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please help me out... I've tried all kinds of things (including help
Can Someone please help me? I have a Checkbox with a Textbox as its
Can someone please help me figure out what I'm doing wrong? I have a
Can someone please help me in writing the exact query, which can give me
Can someone please help me in this minute error. I wrote this, (which is
Can someone please help with instructions for a workaround on the Apache Ant installation
Can someone please help! How can I highlight all web elements in following class
Can someone please help me with regex for the string between 'request=' and '>'
Can someone please help quickly mute or unmute the stage volume in Flash CS3
can someone please help me. why does this return an error: Dim stuff As

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.