Like Tree1Likes
  • 1 Post By adeyblue

Compiling GTK+ C Programs in Code Blocks

This is a discussion on Compiling GTK+ C Programs in Code Blocks within the C Programming forums, part of the General Programming Boards category; I've set it up to search all directories installed for the .h and other files it needs, so the compiler ...

  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    40

    Compiling GTK+ C Programs in Code Blocks

    I've set it up to search all directories installed for the .h and other files it needs, so the compiler gets so far that it doesn't error with that. However, I get all sorts of error messages similar to:

    Undefined reference to `gtk_init_abi_check'

    I've been all over Google trying to find an answer to this, but none of them relate to Code Blocks and give Command Line syntaxes (there is a feature in Code Blocks that allows me to add those, but it still gives the same error messages).

    Does anyone else work with Code Blocks? Do you have any idea how to go about fixing this? Thanks!

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    2,779
    Add the needed library in the Code::Blocks in the project linker library section.

    Note: I suggest turning on Full Compiler Logging.
    FAQ - CodeBlocks


    Tim S.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    Undefined reference is usually a linker error that means that it can't find the actual function. The header file just declares the function, i.e. gives it's name, parameter count and types, and return type. To actually link against that library and use the gtk_init_abi_check function in your final program, you need a couple things. First, you need the actual GTK+ library on your Windows system, not just the headers. Second, you need to tell the compiler/IDE where to find the library. I don't use Code::Blocks, so you'll have to check the docs for the specifics.

  4. #4
    Member
    Join Date
    Mar 2011
    Posts
    40
    Thanks for the feedback! It turned out that actually, even though I'm on 64-Bit Windows 7, I had to use the 32-Bit version of GTK+ for some reason. Now things compile, but I get an error message from the program:

    The application was unable to start correctly (0xc000007b). Click OK to close the application.

    What could be causing this?

  5. #5
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    612
    0xC000007B - STATUS_INVALID_IMAGE_FORMAT

    You're probably linking to the 32-bit GTK dll from a 64-bit application or vice versa

  6. #6
    Member
    Join Date
    Mar 2011
    Posts
    40
    When I use the 64-Bit libraries, I get the aforementioned errors (such as Undefined reference to `gtk_init_abi_check') while trying to compile. When I use the 32-Bit libraries, I get the 0xC000007B error. This is the confusing part.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need to run a shell script in code blocks
    By binnyshah in forum Windows Programming
    Replies: 0
    Last Post: 07-14-2010, 05:05 AM
  2. keeping track of code blocks
    By Aisthesis in forum C++ Programming
    Replies: 9
    Last Post: 05-12-2009, 11:13 PM
  3. Compiling 3rd party code problem me too
    By siavoshkc in forum C Programming
    Replies: 1
    Last Post: 09-12-2007, 06:55 AM
  4. Reusing code blocks for different variables
    By Queue in forum C Programming
    Replies: 16
    Last Post: 09-16-2006, 12:34 PM
  5. code to run (linux) programs WITH arguments
    By N8760 in forum C++ Programming
    Replies: 3
    Last Post: 12-27-2001, 03:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21