Application won't start (0xc000007b) with GTK+ and C

0

I have written an really basic test application in C with GTK+ 3, but when I want to start this application I'm getting the following error:

The application was unable to start correctly (0xc000007b)

But Im getting this only with GTK+ 3.

My Code:

#include <stdio.h>
#include <gtk/gtk.h>

static void activate(GtkApplication *app, gpointer user_data) {
    GtkWidget *window;

    window = gtk_application_window_new(app);

    gtk_window_set_title(GTK_WINDOW (window), "Tutorial");
    gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
    gtk_widget_show_all(window);

}

int main(int argc, char **argv) {
    printf("Hello, World!\n");

    //printf("Ein akustisches Signal mit : (\\a)\a");
    printf("\nEin Backspace mit : (\\b) | \bx\n");
    printf("Ein Zeilenvorschub mit : (\\t) |\tx");
    printf("\n\tC\n\ti\n\ts\n\tt\n\ttoll\n");
    printf("\t   u\n\t   n\n\t   d\n");
    printf("\t   macht Spaß\n");

    //Kommentar 1
    /* Kommentar 2 */
    /*
     * Mehrzeiliges Kommentar
     */

    GtkApplication *app;
    int status;

    app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);

    g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);

    status = g_application_run(G_APPLICATION(app), argc, argv);

    g_object_unref(app);

    return status;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.7)
project(tutorial)

set(CMAKE_C_STANDARD 99)

set(SOURCE_FILES main.c)

set(PKG_CONFIG_EXECUTABLE "C:/msys64/mingw64/bin/pkg-config.exe")

FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)

INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})

add_executable(tutorial ${SOURCE_FILES})

ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})

TARGET_LINK_LIBRARIES(tutorial ${GTK3_LIBRARIES})

Im using Clion 2017.1.3, mingw-w64 5.0 and cmake 3.7.2 (x64) with gdb 7.11.1 (x64)

c
gtk
64-bit
asked on Stack Overflow Jul 4, 2017 by Nightloewe • edited Jul 4, 2017 by iehrlich

1 Answer

0

Ok, I fixed my own bug ^^

I set an GTK_BASEPATH in my system variables and the PATH variable to an old version of GTK (32 bit) and It used these files as library.

answered on Stack Overflow Jul 4, 2017 by Nightloewe

User contributions licensed under CC BY-SA 3.0