Author Topic: same code but " Process terminated with status -1 (0 minute(s), 0 second(s))"  (Read 2878 times)

Offline niconol

  • Multiple posting newcomer
  • *
  • Posts: 16
Hi,

I'm starting with gtkmm

My first application main.cpp:
Code
#include <gtkmm/main.h>
#include <gtkmm/table.h>
#include <gtkmm/label.h>
#include <gtkmm/window.h>


int main(int argc, char* argv[]) {
    Gtk::Main app(argc, argv);

    Gtk::Window fenetre;

    Gtk::Table tableau(1, 2); //Création d'un tableau de 1 case par 2 cases, dont les cases ne sont pas nécessairement de même grandeur.
    tableau.resize(3, 6); //Redimensionner le tableau (2 par 2).
    tableau.set_col_spacings(30);
    tableau.set_row_spacings(30);
    //tableau.set
    fenetre.add(tableau);

    Gtk::Label etiquette1("initiale");
    Gtk::Label etiquette2("minimale");
    Gtk::Label etiquette3("maximale");
    Gtk::Label etiquette4("finale");
    Gtk::Label etiquette5("temps 0-90%");
    Gtk::Label etiquette6("temps 25-75%");
    etiquette1.set_can_focus(false);
    etiquette2.set_can_focus(false);
    etiquette3.set_can_focus(false);
    etiquette4.set_can_focus(false);
    etiquette5.set_can_focus(false);
    etiquette6.set_can_focus(false);

    tableau.attach(etiquette1, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); //Ajout d'un widget dans le tableau : ce widget sera de (0, 0) à (1, 1). Le widget prend le moins d'espace possible.
    tableau.attach(etiquette2, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); //Ajout d'un widget dans le tableau : ce widget sera de (0, 0) à (1, 1). Le widget prend le moins d'espace possible.
    tableau.attach(etiquette3, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); //Ajout d'un widget dans le tableau : ce widget sera de (0, 0) à (1, 1). Le widget prend le moins d'espace possible.
    tableau.attach(etiquette4, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK); //Ajout d'un widget dans le tableau : ce widget sera de (0, 0) à (1, 1). Le widget prend le moins d'espace possible.
    tableau.attach(etiquette5, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); //Ajout d'un widget dans le tableau : ce widget sera de (0, 0) à (1, 1). Le widget prend le moins d'espace possible.
    tableau.attach(etiquette6, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK); //Ajout d'un widget dans le tableau : ce widget sera de (0, 0) à (1, 1). Le widget prend le moins d'espace possible.
    //tableau.attach(bouton2, 1, 2, 0, 1); //Le widget prend l'espace qui lui est alloué et tout autre espace additionnel.
    //tableau.attach(bouton3, 0, 2, 1, 2, Gtk::FILL, Gtk::FILL, 25, 10); //Le widget prend l'espace qui lui est alloué. Ajout d'espace (25px horizontal et 10px vertical) autour du widget.

    fenetre.show_all(); //L'habituel show_all() pour afficher tous les widgets.

    Gtk::Main::run(fenetre);

    return 0;
}

compiled and executed successfully.

.cbp is:

Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="IHM1" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/IHM1" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
<Add option="`pkg-config gtkmm-3.0 --cflags`" />
</Compiler>
<Linker>
<Add option="`pkg-config gtkmm-3.0 --libs`" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/IHM1" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

If I add this linker setting
Quote
`pkg-config opencv --libs`

building:

Code
-------------- Clean: Debug in IHM1 (compiler: GNU GCC Compiler)---------------

Cleaned "IHM1 - Debug"

-------------- Build: Debug in IHM1 (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g -pthread -I/usr/include/gtkmm-3.0 -I/usr/lib/arm-linux-gnueabihf/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/arm-linux-gnueabihf/gdkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/arm-linux-gnueabihf/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/arm-linux-gnueabihf/pangomm-1.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/arm-linux-gnueabihf/glibmm-2.4/include -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/sigc++-2.0 -I/usr/lib/arm-linux-gnueabihf/sigc++-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -std=c++11  -c /home/pi/Desktop/main.cpp -o obj/Debug/main.o
g++  -o bin/Debug/IHM1 obj/Debug/main.o  -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0  /usr/lib/arm-linux-gnueabihf/libopencv_calib3d.so -lopencv_calib3d /usr/lib/arm-linux-gnueabihf/libopencv_contrib.so -lopencv_contrib /usr/lib/arm-linux-gnueabihf/libopencv_core.so -lopencv_core /usr/lib/arm-linux-gnueabihf/libopencv_features2d.so -lopencv_features2d /usr/lib/arm-linux-gnueabihf/libopencv_flann.so -lopencv_flann /usr/lib/arm-linux-gnueabihf/libopencv_gpu.so -lopencv_gpu /usr/lib/arm-linux-gnueabihf/libopencv_highgui.so -lopencv_highgui /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.so -lopencv_imgproc /usr/lib/arm-linux-gnueabihf/libopencv_legacy.so -lopencv_legacy /usr/lib/arm-linux-gnueabihf/libopencv_ml.so -lopencv_ml /usr/lib/arm-linux-gnueabihf/libopencv_objdetect.so -lopencv_objdetect /usr/lib/arm-linux-gnueabihf/libopencv_ocl.so -lopencv_ocl /usr/lib/arm-linux-gnueabihf/libopencv_photo.so -lopencv_photo /usr/lib/arm-linux-gnueabihf/libopencv_stitching.so -lopencv_stitching /usr/lib/arm-linux-gnueabihf/libopencv_superres.so -lopencv_superres /usr/lib/arm-linux-gnueabihf/libopencv_ts.so -lopencv_ts /usr/lib/arm-linux-gnueabihf/libopencv_video.so -lopencv_video /usr/lib/arm-linux-gnueabihf/libopencv_videostab.so -lopencv_videostab   
Output file is bin/Debug/IHM1 with size 50,66 KB
Process terminated with status 0 (0 minute(s), 11 second(s))
0 error(s), 0 warning(s) (0 minute(s), 11 second(s))

running:
Code
-------------- Run: Debug in IHM1 (compiler: GNU GCC Compiler)---------------

Checking for existence: /home/pi/Desktop/bin/Debug/IHM1
Executing: /home/pi/Desktop/bin/Debug/IHM1  (in /home/pi/Desktop/.)
Process terminated with status -1 (0 minute(s), 0 second(s))

Why does this happen?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
What happens if you run the executable in terminal?
What happens if you try to debug the executable?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline niconol

  • Multiple posting newcomer
  • *
  • Posts: 16
If I run it in terminal, sudo, there are bugs, for examples, on timers or usbkey access

If I try debug it, "my usb mouse is removed", I loose my keyboard too, ... and I need to unplug and replug my RPI to restart

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
I have no idea what you're talking about, but all those problems are not caused by C::B...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]