Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Why is gcc not detecting given name?

$
0
0

I'm writing a simple console program to compile a gtk3 app for windows.

The code gives the compiler the proper "-o" flag to output a file with the given name, "gtktest.exe" in this case.

Here is the code:

#include <stdlib.h>#include <string.h>#include <stdio.h>int main(int argc, char **argv) {    int i;    char *entryFile, *outputFile;    for (i = 0; i < argc; i++) {        if (strcmp(argv[i], "-i") == 0) {            entryFile = argv[i + 1];        }        if (strcmp(argv[i], "-o") == 0) {            outputFile = argv[i + 1];        }    }    FILE *fp;    char includes[1000], command[1000];    fp = popen("pkg-config --cflags --libs gtk+-3.0", "r");    fgets(includes, sizeof(includes), fp);    pclose(fp);    sprintf(command, "gcc %s %s -o %s", entryFile, includes, outputFile);    system(command);    return 0;}

but all that comes out is a.exe (I guess the default name gcc outputs).

I'm using c89 if that gives any hint as to the issue.

Any help is appreciated.

EDIT: I did that but it didn't seem to give any idea as to the cause (I will note that for some reason it goes to another line)

gcc gtktest.c -pthread -mms-bitfields -IC:/msys64/mingw64/include/gtk-3.0 -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/pango-1.0 -IC:/msys64/mingw64/include/fribidi -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/atk-1.0 -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/gdk-pixbuf-2.0 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include -LC:/msys64/mingw64/lib -lgtk-3 -lgdk-3 -lz -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -o gtktest2.exe

Viewing all articles
Browse latest Browse all 21994

Trending Articles