I'm currently trying to compile some code examples from
http://developer.gnome.org/gtkmm-tutorial/unstable/sec-treeview-examples.html.en
but from what I can see Ubuntu 11.10 gtkmm-3.0 is missing the file
/usr/include/gtkmm-3.0/gtkmm/application.h
and I can't find it anywhere else:
apt-file search "gtkmm/application.h"
returns nothing.
Even more strange, Application is not referenced anywhere under /usr/include/gtkmm-3.0/gtkmm.
Here's the main function
#include "../examplewindow.hpp"
#include <gtkmm/application.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
ExampleWindow window;
return app->run(window);
}
Have I missed something? Has the API changed recently?
After reading the good answers:
For now, with gtkmm 3.2, I use
#include "../examplewindow.hpp"
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
ExampleWindow window;
Gtk::Main::run(window);
}
instead. What do I gain by using the 3.4 Application Interface instead?
According to the Gtk::Application documentation, it only exists on gtkmm 3.4+.
You can check the installed version of the package with:
pkg-config --modversion gtkmm-3.0
There was some issues wrapping GtkApplication for gtkmm 3.0 and 3.2. It's now in the 3.3.x development sources, but was recently considered "not ready". I assume it will be in good shape when 3.4 is released.
Related
I have set up Eclipse (on Ubuntu 20.04) for C/C++ programming and are attempting to configure the IDE for Gtkmm.
I have installed the Pkg-config support for Eclipse for CDT 1.0.0 plug-in.
Then I have created a new C++ project and checked the Gtkmm-3.0 box in
Properties
—C/C++ build
—Settings
— Pkg-config
Then I try to compile the following program:
#include <gtkmm.h>
class MyWindow : public Gtk::Window
{
public:
MyWindow();
};
MyWindow::MyWindow()
{
set_title("Basic application");
set_default_size(200, 200);
}
int main(int argc, char* argv[])
{
auto app = Gtk::Application::create("org.gtkmm.examples.base");
return app->make_window_and_run<MyWindow>(argc, argv);
}
But I get the following error:
Fatal error: Gtkmm.h : Cannot find file or folder
How do I configure the IDE or project to get it to compile?
Regards
Jarl
include .....
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
namedWindow("My Image");
waitKey();
return a.exec();
}
Here's code. A window displayed and then program crashed.
I followed the tutorial that used Qt+mingw to build mingw version lib.
If I use msvc version lib and compiler directly (don't need to build lib manually) , it works fine.
Now I believe that maybe some procedure lead the error. Just use msvc be OK.
I recently installed VlcQt libary for ubuntu 16.04, but when I try to use it, all i get is undefined reference to 'some_function()'.
Currently I am trying to expose video player to QML.
Main.cpp
#include <QGuiApplication>
#include <VLCQtCore/Common.h>
#include <VLCQtQml/QmlVideoPlayer.h>
#include "Controller.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
VlcCommon::setPluginPath(app.applicationDirPath() + "plugins");
VlcQmlVideoPlayer::registerPlugin();
Controller controller;
QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(controller.view());
quickWindow->show();
return app.exec();
}
When I am trying to include libaries, Qt intellisense is detecting that this libary exists.
What am I doing wrong?
Thank you for your help!
//Edit:
I installed it via their repository:
add-apt-repository ppa:ntadej/tano
apt-get install libvlc-qt-core2 libvlc-qt-widgets2 libvlc-qt-dbg libvlc-qt-dev
//Edit:
This is how I add libs in .pro file, already tried INCLUDEPATH too
LIBS += -lvlccore -lvlc
Earlier in the day, every thing worked nice as hell, suddenly it all broke.
#include <QtGui/QApplication>
int main(int argc, char** argv) {
QApplication app {argc, argv};
}
Compile with g++ main.cpp -lQtCore -lQtGui -I/usr/include/qt4, gives me a segfault, and I have no clue why.
I have made some investigation on the matter, and it seems that something may be wrong with either argc or argv, but earlier in the day this didn't happen at all.
Upgrading to Qt5 from Qt4 solved the problem.
I have downloaded and installed Qt and I'm learning how to use it.
So, I created a new project myfristqt (empty project). I then added a main.cpp file with this code:
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
return app.exec();
}
First thing I noticed #include <QApplication> line is hightlighted with a red line as if QApplication was an unknown identifier. So, I compiled it to see what happens and here's the error I got:
(internal):1: error : Using OS scope before setting MAKEFILE_GENERATOR
Any idea why this is happening ? I'm using Windows XP
MAKEFILE_GENERATOR is a qmake variable.
This variable contains the name of the Makefile generator to use when generating a Makefile. The value of this variable is typically handled internally by qmake and rarely needs to be modified.
It define in QTDIR/mkspecs/PLATFORM/qmake.conf. Where PLATFORM is maybe cygwin-g++, win32-msvc200x on your Windows XP.