Skip to content
Snippets Groups Projects
Commit 43cc5a6d authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Beispiele und Screenshots 21.11.2024

parent 179bd729
No related branches found
No related tags found
No related merge requests found
Showing
with 521 additions and 0 deletions
extern int prompfl (const char *__restrict __format, ...);
int main (void)
{
prompfl ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 hello-03.c -o hello-03
/usr/bin/ld: /tmp/ccjQD6my.o: in function `main':
hello-03.c:(.text.startup+0xe): undefined reference to `prompfl'
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121>
#include <stdio.h>
int main (void)
{
prompfl ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 hello-04.c -o hello-04
hello-04.c: In function ‘main’:
hello-04.c:5:3: warning: implicit declaration of function ‘prompfl’ [-Wimplicit-function-declaration]
5 | prompfl ("Hello, world!\n");
| ^~~~~~~
/usr/bin/ld: /tmp/cc7nSdVt.o: in function `main':
hello-04.c:(.text.startup+0xe): undefined reference to `prompfl'
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> cat hello-01.c
#include <stdio.h>
int main (void)
{
printf ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 hello-01.c -o hello-01
cassini/home/peter/bo/2024ws/hp/20241121> gcc -v -Wall -O3 hello-01.c -o hello-01
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-O3' '-o' 'hello-01' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/12/cc1 -quiet -v -imultiarch x86_64-linux-gnu hello-01.c -quiet -dumpbase hello-01.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O3 -Wall -version -fasynchronous-unwind-tables -o /tmp/ccA09rK1.s
GNU C17 (Debian 12.2.0-14) version 12.2.0 (x86_64-linux-gnu)
compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version 4.1.1-p1, MPC version 1.3.1, isl version isl-0.25-GMP
warning: MPFR header version 4.1.1-p1 differs from library version 4.2.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/12/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C17 (Debian 12.2.0-14) version 12.2.0 (x86_64-linux-gnu)
compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version 4.1.1-p1, MPC version 1.3.1, isl version isl-0.25-GMP
warning: MPFR header version 4.1.1-p1 differs from library version 4.2.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: cc72d2b9b5048fedc2be9051c917b40b
COLLECT_GCC_OPTIONS='-v' '-Wall' '-O3' '-o' 'hello-01' '-mtune=generic' '-march=x86-64'
as -v --64 -o /tmp/ccp4LGun.o /tmp/ccA09rK1.s
GNU assembler version 2.40 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.40
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/12/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-Wall' '-O3' '-o' 'hello-01' '-mtune=generic' '-march=x86-64' '-dumpdir' 'hello-01.'
/usr/lib/gcc/x86_64-linux-gnu/12/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/12/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper -plugin-opt=-fresolution=/tmp/ccotiWx4.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o hello-01 /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/12/../../.. /tmp/ccp4LGun.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/crtn.o
COLLECT_GCC_OPTIONS='-v' '-Wall' '-O3' '-o' 'hello-01' '-mtune=generic' '-march=x86-64' '-dumpdir' 'hello-01.'
cassini/home/peter/bo/2024ws/hp/20241121>
#include <stdio.h>
void prompfl (char *s)
{
printf (s);
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O prompfl-01.c -o prompfl-01
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121> cat hello-04.c
#include <stdio.h>
int main (void)
{
prompfl ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O hello-04.c –o hello-04
hello-04.c: In function ‘main’:
hello-04.c:5:3: warning: implicit declaration of function ‘prompfl’ [-Wimplicit-function-declaration]
5 | prompfl ("Hello, world!\n");
| ^~~~~~~
/usr/bin/ld: cannot find –o: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: cannot find hello-04: Datei oder Verzeichnis nicht gefunden
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O hello-04.c prompfl-01.c –o hello-04
hello-04.c: In function ‘main’:
hello-04.c:5:3: warning: implicit declaration of function ‘prompfl’ [-Wimplicit-function-declaration]
5 | prompfl ("Hello, world!\n");
| ^~~~~~~
/usr/bin/ld: cannot find –o: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: cannot find hello-04: Datei oder Verzeichnis nicht gefunden
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O hello-04.c prompfl-01.c -o hello-04
hello-04.c: In function ‘main’:
hello-04.c:5:3: warning: implicit declaration of function ‘prompfl’ [-Wimplicit-function-declaration]
5 | prompfl ("Hello, world!\n");
| ^~~~~~~
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> cat hello-05.c
extern void prompfl (char *s);
int main (void)
{
prompfl ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> cat prompfl-01.c
#include <stdio.h>
void prompfl (char *s)
{
printf (s);
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O hello-05.c prompfl-01.c -o hello-05
cassini/home/peter/bo/2024ws/hp/20241121> ./hello-05
Hello, world!
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> cat hello-06.c
#include "prompfl-01.h"
int main (void)
{
prompfl ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> cat prompfl-01.h
extern void prompfl (char *s);
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O hello-06.c prompfl-01.c -o hello-06
cassini/home/peter/bo/2024ws/hp/20241121> ./hello-06
Hello, world!
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> cat hello-06.c
#include "prompfl-01.h"
int main (void)
{
prompfl ("Hello, world!\n");
return 0;
}
cassini/home/peter/bo/2024ws/hp/20241121> cat prompfl-01.h
extern void prompfl (char *s);
cassini/home/peter/bo/2024ws/hp/20241121> cat prompfl-01.c
#include <stdio.h>
void prompfl (char *s)
{
printf (s);
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 hello-06.c -c
cassini/home/peter/bo/2024ws/hp/20241121> ls -l hello-06.o
-rw-r--r-- 1 peter peter 1448 21. Nov 11:47 hello-06.o
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 prompfl-01.c -c
cassini/home/peter/bo/2024ws/hp/20241121> ls -l prompfl-01.o
-rw-r--r-- 1 peter peter 1216 21. Nov 11:47 prompfl-01.o
cassini/home/peter/bo/2024ws/hp/20241121> gcc hello-06.o prompfl-01.o -o hello-06
cassini/home/peter/bo/2024ws/hp/20241121> ./hello-06
Hello, world!
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> ar cq libprompfl.a prompfl-01.o
cassini/home/peter/bo/2024ws/hp/20241121> ls -l libprompfl.a
-rw-r--r-- 1 peter peter 1360 21. Nov 11:52 libprompfl.a
cassini/home/peter/bo/2024ws/hp/20241121> gcc hello-06.o libprompfl.a -o hello-06
cassini/home/peter/bo/2024ws/hp/20241121> ./hello-06
Hello, world!
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> gcc hello-06.o -l prompfl -o hello-06
/usr/bin/ld: cannot find -lprompfl: Datei oder Verzeichnis nicht gefunden
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121> gcc hello-06.o -L . -l prompfl -o hello-06
cassini/home/peter/bo/2024ws/hp/20241121> ./hello-06
Hello, world!
cassini/home/peter/bo/2024ws/hp/20241121>
#include <gtk/gtk.h>
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 gtk-01.c -o gtk-01
gtk-01.c:1:10: fatal error: gtk/gtk.h: Datei oder Verzeichnis nicht gefunden
1 | #include <gtk/gtk.h>
| ^~~~~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> ls -l /usr/include/gtk-4.0/gtk/gtk.h
-rw-r--r-- 1 root root 9420 22. Dez 2022 /usr/include/gtk-4.0/gtk/gtk.h
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I /usr/include/gtk-4.0 gtk-01.c -o gtk-01
In file included from /usr/include/gtk-4.0/gtk/gtk.h:30,
from gtk-01.c:1:
/usr/include/gtk-4.0/gtk/css/gtkcss.h:30:10: fatal error: glib.h: Datei oder Verzeichnis nicht gefunden
30 | #include <glib.h>
| ^~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I /usr/include/gtk-4.0 -I /usr/include/glib-2.0 gtk-01.c -o gtk-01
In file included from /usr/include/glib-2.0/glib/galloca.h:34,
from /usr/include/glib-2.0/glib.h:32,
from /usr/include/gtk-4.0/gtk/css/gtkcss.h:30,
from /usr/include/gtk-4.0/gtk/gtk.h:30,
from gtk-01.c:1:
/usr/include/glib-2.0/glib/gtypes.h:34:10: fatal error: glibconfig.h: Datei oder Verzeichnis nicht gefunden
34 | #include <glibconfig.h>
| ^~~~~~~~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121>
#include <gtk/gtk.h>
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 gtk-01.c -o gtk-01
gtk-01.c:1:10: fatal error: gtk/gtk.h: Datei oder Verzeichnis nicht gefunden
1 | #include <gtk/gtk.h>
| ^~~~~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> ls -l /usr/include/gtk-4.0/gtk/gtk.h
-rw-r--r-- 1 root root 9420 22. Dez 2022 /usr/include/gtk-4.0/gtk/gtk.h
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I /usr/include/gtk-4.0 gtk-01.c -o gtk-01
In file included from /usr/include/gtk-4.0/gtk/gtk.h:30,
from gtk-01.c:1:
/usr/include/gtk-4.0/gtk/css/gtkcss.h:30:10: fatal error: glib.h: Datei oder Verzeichnis nicht gefunden
30 | #include <glib.h>
| ^~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I /usr/include/gtk-4.0 -I /usr/include/glib-2.0 gtk-01.c -o gtk-01
In file included from /usr/include/glib-2.0/glib/galloca.h:34,
from /usr/include/glib-2.0/glib.h:32,
from /usr/include/gtk-4.0/gtk/css/gtkcss.h:30,
from /usr/include/gtk-4.0/gtk/gtk.h:30,
from gtk-01.c:1:
/usr/include/glib-2.0/glib/gtypes.h:34:10: fatal error: glibconfig.h: Datei oder Verzeichnis nicht gefunden
34 | #include <glibconfig.h>
| ^~~~~~~~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> cat >> extern-10.txt
#include <gtk/gtk.h>
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 gtk-01.c -o gtk-01
gtk-01.c:1:10: fatal error: gtk/gtk.h: Datei oder Verzeichnis nicht gefunden
1 | #include <gtk/gtk.h>
| ^~~~~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> ls -l /usr/include/gtk-4.0/gtk/gtk.h
-rw-r--r-- 1 root root 9420 22. Dez 2022 /usr/include/gtk-4.0/gtk/gtk.h
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I /usr/include/gtk-4.0 gtk-01.c -o gtk-01
In file included from /usr/include/gtk-4.0/gtk/gtk.h:30,
from gtk-01.c:1:
/usr/include/gtk-4.0/gtk/css/gtkcss.h:30:10: fatal error: glib.h: Datei oder Verzeichnis nicht gefunden
30 | #include <glib.h>
| ^~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I /usr/include/gtk-4.0 -I /usr/include/glib-2.0 gtk-01.c -o gtk-01
In file included from /usr/include/glib-2.0/glib/galloca.h:34,
from /usr/include/glib-2.0/glib.h:32,
from /usr/include/gtk-4.0/gtk/css/gtkcss.h:30,
from /usr/include/gtk-4.0/gtk/gtk.h:30,
from gtk-01.c:1:
/usr/include/glib-2.0/glib/gtypes.h:34:10: fatal error: glibconfig.h: Datei oder Verzeichnis nicht gefunden
34 | #include <glibconfig.h>
| ^~~~~~~~~~~~~~
compilation terminated.
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> pkg-config --cflags --libs gtk4
-I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -mfpmath=sse -msse -msse2 -pthread -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -mfpmath=sse -msse -msse2 -pthread -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 gtk-01.c -o gtk-01
/usr/bin/ld: /tmp/ccX23Ylz.o: in function `activate':
gtk-01.c:(.text+0x7): undefined reference to `gtk_application_window_new'
/usr/bin/ld: gtk-01.c:(.text+0xf): undefined reference to `gtk_window_get_type'
/usr/bin/ld: gtk-01.c:(.text+0x1d): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: gtk-01.c:(.text+0x2c): undefined reference to `gtk_window_set_title'
/usr/bin/ld: gtk-01.c:(.text+0x37): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: gtk-01.c:(.text+0x45): undefined reference to `gtk_window_present'
/usr/bin/ld: /tmp/ccX23Ylz.o: in function `main':
gtk-01.c:(.text.startup+0x13): undefined reference to `gtk_application_new'
/usr/bin/ld: gtk-01.c:(.text.startup+0x34): undefined reference to `g_signal_connect_data'
/usr/bin/ld: gtk-01.c:(.text.startup+0x39): undefined reference to `g_application_get_type'
/usr/bin/ld: gtk-01.c:(.text.startup+0x44): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: gtk-01.c:(.text.startup+0x51): undefined reference to `g_application_run'
/usr/bin/ld: gtk-01.c:(.text.startup+0x5b): undefined reference to `g_object_unref'
collect2: error: ld returned 1 exit status
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 -I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -mfpmath=sse -msse -msse2 -pthread gtk-01.c -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -o gtk-01
cassini/home/peter/bo/2024ws/hp/20241121> ./gtk-01
^C
cassini/home/peter/bo/2024ws/hp/20241121>
cassini/home/peter/bo/2024ws/hp/20241121> gcc -Wall -O3 gtk-01.c $(pkg-config --cflags --libs gtk4) -o gtk-01
cassini/home/peter/bo/2024ws/hp/20241121> ./gtk-01
cassini/home/peter/bo/2024ws/hp/20241121>
#include <gtk/gtk.h>
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
#include <stdio.h>
static void activate (GtkApplication *app, gpointer user_data)
{
printf ("activate()\n");
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
#include <stdio.h>
static void activate (GtkApplication *app, gpointer user_data)
{
printf ("activate()\n");
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-01", G_APPLICATION_DEFAULT_FLAGS);
printf ("vor g_signal_connect()\n");
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
printf ("vor g_application_run()\n");
int status = g_application_run (G_APPLICATION (app), argc, argv);
printf ("nach g_application_run()\n");
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
#include <stdio.h>
static void hello (GtkWidget *this, gpointer user_data)
{
char *world = user_data;
printf ("Hello, %s!\n", world);
}
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
GtkWidget *button = gtk_button_new_with_label ("Hello, world!");
g_signal_connect (button, "clicked", G_CALLBACK (hello), "world");
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.gtk-02", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
static void close_window (GtkWidget *this, gpointer user_data)
{
GtkWindow *window = user_data;
gtk_window_destroy (window);
}
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
GtkWidget *button = gtk_button_new_with_label ("Quit");
g_signal_connect (button, "clicked", G_CALLBACK (close_window), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.hello-gtk", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
GtkWidget *button = gtk_button_new_with_label ("Quit");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.hello-gtk", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
#include <gtk/gtk.h>
static void hello (GtkWidget *this, gpointer user_data)
{
char *world = user_data;
printf ("Hello, %s!\n", world);
}
static void activate (GtkApplication *app, gpointer user_data)
{
GtkWidget *window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_window_set_child (GTK_WINDOW (window), vbox);
GtkWidget *hello_button = gtk_button_new_with_label ("Hello, world!");
g_signal_connect (hello_button, "clicked", G_CALLBACK (hello), "world");
gtk_box_append (GTK_BOX (vbox), hello_button);
GtkWidget *quit_button = gtk_button_new_with_label ("Quit");
g_signal_connect_swapped (quit_button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_box_append (GTK_BOX (vbox), quit_button);
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char **argv)
{
GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.hello-gtk", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment