I am trying to setup gtkmm on my Windows 7 system. I have installed Glade 3.6.1 and gtkmm Development Environment 2.22.0-2.
When I tried to run the sample code below, I am unable to compile and run.
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window window;
Gtk::Main::run(window);
return 0;
}
The compile log:
Compiler: Default compiler Building Makefile:
"C:\Dev-Cpp\Makefile.win" Executing make... make.exe -f
"C:\Dev-Cpp\Makefile.win" main.o g++.exe -c main.cpp -o main.o
-I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -mms-bitfields -IC:/GTK/include/gtkmm-2.4 -IC:/GTK/lib/gtkmm-2.4/include -IC:/GTK/include/atkmm-1.6 -IC:/GTK/include/giomm-2.4 -IC:/GTK/lib/giomm-2.4/include -IC:/GTK/include/pangomm-1.4 -IC:/GTK/lib/pangomm-1.4/include -IC:/GTK/include/gtk-2.0 -IC:/GTK/include/gdkmm-2.4 -IC:/GTK/lib/gdkmm-2.4/include -IC:/GTK/include/atk-1.0 -IC:/GTK/include/glibmm-2.4 -IC:/GTK/lib/glibmm-2.4/include -IC:/GTK/include/glib-2.0 -IC:/GTK/lib/glib-2.0/include -IC:/GTK/include/sigc++-2.0 -IC:/GTK/lib/sigc++-2.0/include -IC:/GTK/include/cairomm-1.0 -IC:/GTK/lib/cairomm-1.0/include -IC:/GTK/include/pango-1.0 -IC:/GTK/include/cairo -IC:/GTK/include -IC:/GTK/include/freetype2 -IC:/GTK/include/libpng14 -IC:/GTK/lib/gtk-2.0/include -IC:/GTK/include/gdk-pixbuf-2.0 -IC:/GTK/include/libglademm-2.4
In file included from
C:/GTK/include/glibmm-2.4/glibmm/containerhandle_shared.h:24,
from C:/GTK/include/glibmm-2.4/glibmm/arrayhandle.h:23,
from C:/GTK/include/glibmm-2.4/glibmm.h:82,
from C:/GTK/include/gtkmm-2.4/gtkmm.h:87,
from main.cpp:1: C:/GTK/include/glibmm-2.4/glibmm/ustring.h:861: error: ISO C++ forbids
declaration of wostringstream' with no type
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:861: error: expected;'
before "StreamType" C:/GTK/include/glibmm-2.4/glibmm/ustring.h:865:
error: `StreamType' does not name a type
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:906: error: expected
constructor, destructor, or type conversion before '&' token
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:906: error: expected ,' or
;' before '&' token C:/GTK/include/glibmm-2.4/glibmm/ustring.h:912:
error: expected constructor, destructor, or type conversion before '&'
token C:/GTK/include/glibmm-2.4/glibmm/ustring.h:912: error: expected
,' or;' before '&' token
C:/GTK/include/glibmm-2.4/glibmm/ustring.h: In member function void
Glib::ustring::FormatStream::stream(const T&)':
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1057: error:stream_'
undeclared (first use this function)
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1057: error: (Each
undeclared identifier is reported only once for each function it
appears in.)
C:/GTK/include/glibmm-2.4/glibmm/ustring.h: In member function void
Glib::ustring::FormatStream::stream(const char*)':
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1063: error:stream_'
undeclared (first use this function)
C:/GTK/include/glibmm-2.4/glibmm/ustring.h: In member function void
Glib::ustring::FormatStream::stream(char*)':
C:/GTK/include/glibmm-2.4/glibmm/ustring.h:1069: error:stream_'
undeclared (first use this function)
make.exe: * [main.o] Error 1
Execution terminated
Any help with the setup would be greatly appreciated.
Thanks!
Related
I tried Compile the latest tiled from source code following the instructions in README.md.
My working environment:
tiled source code: tiled-0.16.1
Mac OS: 10.11.1
Xcode : 7.1
QMake: 3.0
Qt: 5.7.0
Apple LLVM: 7.0.0
But the make failed with the following error:
In file included from pythonplugin.cpp:21:
In file included from ./pythonplugin.h:30:
In file included from ../../libtiled/logginginterface.h:33:
In file included from ../../libtiled/tiled_global.h:32:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:61:4: error: "Qt requires C++11 support"
# error "Qt requires C++11 support"
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:90:13: error: unknown type name 'QAtomicOps'
typedef QAtomicOps<T> Ops;
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:90:23: error: expected member name or ';' after declaration
specifiers
typedef QAtomicOps<T> Ops;
~~~~~~~~~~~~~~~~~~^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:93:23: error: use of undeclared identifier 'QAtomicOpsSupport'
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:746:66: note: expanded from macro 'Q_STATIC_ASSERT_X'
#define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
In file included from pythonplugin.cpp:21:
In file included from ./pythonplugin.h:30:
In file included from ../../libtiled/logginginterface.h:33:
In file included from ../../libtiled/tiled_global.h:32:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:93:53: error: no member named 'IsSupported' in the global
namespace
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
~~^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:746:66: note: expanded from macro 'Q_STATIC_ASSERT_X'
#define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
In file included from pythonplugin.cpp:21:
In file included from ./pythonplugin.h:30:
In file included from ../../libtiled/logginginterface.h:33:
In file included from ../../libtiled/tiled_global.h:32:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:95:14: error: use of undeclared identifier 'Ops'
typename Ops::Type _q_value;
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:95:19: error: expected a qualified name after 'typename'
typename Ops::Type _q_value;
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:95:23: error: expected ';' at end of declaration list
typename Ops::Type _q_value;
^
;
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:99:44: error: use of undeclared identifier 'Ops'
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:99:54: error: use of undeclared identifier '_q_value'
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:100:45: error: use of undeclared identifier 'Ops'
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:100:56: error: use of undeclared identifier '_q_value'
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:102:51: error: use of undeclared identifier 'Ops'
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:102:68: error: use of undeclared identifier '_q_value'
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:103:52: error: use of undeclared identifier 'Ops'
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:103:70: error: use of undeclared identifier '_q_value'
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:107:86: error: use of undeclared identifier 'Ops'
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:107:34: error: no return statement in constexpr function
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); }
^
/Users/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:108:88: error: use of undeclared identifier 'Ops'
static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return Ops::isReferenceCountingWaitFree(); }
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [pythonplugin.o] Error 1
make[2]: *** [sub-python-make_first] Error 2
make[1]: *** [sub-plugins-make_first-ordered] Error 2
make: *** [sub-src-make_first-ordered] Error 2
After doing some research, I tried to add a line CONFIG+= c++11 to the tiled.pro file and then make clean , qmake, make but still I am having the same error ......
tiled.pro :
# Check the Qt version. If QT_VERSION is not set, it is probably Qt 3.
isEmpty(QT_VERSION) {
error("QT_VERSION not defined. Tiled does not work with Qt 3.")
}
include(tiled.pri)
!minQtVersion(5, 1, 0) {
message("Cannot build Tiled with Qt version $${QT_VERSION}")
error("Use at least Qt 5.1.0.")
}
TEMPLATE = subdirs
CONFIG += ordered
CONFIG += c++11
SUBDIRS = src translations
Not sure what goes wrong here.
Any advice will be appreciated, thanks :)
UPDATE:
Tried
QMAKE_CXXFLAGS += -std=c++11
and
QMAKE_CXXFLAGS += -std=c++0x
Still have the same error ......
I thought it might be in the C++ compile the make command use, here is some information :
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c `python-config --cflags` -O2 -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.8 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -fPIC -DPYTHON_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../libtiled -I/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib/QtWidgets.framework/Headers -I/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib/QtGui.framework/Headers -I/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/mkspecs/macx-clang -F/Users/supersuraccoon/Qt5.7.0/5.7/clang_64/lib -o pythonplugin.o pythonplugin.cpp
I had a similar problem building poppler with Qt wrappers and got the same error: "Qt requires C++11 support".
My setup is:
Mac OS: 10.11.5
Xcode : 7.3.1
QMake: 3.0
Qt: 5.7.0
Apple LLVM: 7.3.0
All I did was:
export CXXFLAGS=-std=c++11
./configure
make
and it worked.
I know it has been a while.
How I finally solve this problem is adding in CMakeLists.txt the following line just after project(MyProject):
add_compile_options(-std=c++11)
That says to cmake, to create a Makefile that will use c++11 solving issues.
const char* hi = "hi"; // ok
const char* hi2 = u8"hi"; // compile error
It causes
error: use of undeclared identifier 'u8'
My compiler supports C++ 11.
~/Project/cpp c++ -v
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
Your compiler doesn't default to C++11 though.
[9:46pm][wlynch#watermelon /tmp] c++ -c blah.cc
blah.cc:2:19: error: use of undeclared identifier 'u8'
const char* hi2 = u8"hi"; // compile error
^
blah.cc:2:21: error: expected ';' after top level declarator
const char* hi2 = u8"hi"; // compile error
^
;
2 errors generated.
[9:47pm][wlynch#watermelon /tmp] c++ -c -std=c++11 blah.cc
[9:47pm][wlynch#watermelon /tmp]
Sorry for my english.
I try to add iperf3 (like static link library) to my Qt project (Qt version 4.8.5, OpenSuse 13.1), and has several errors:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../lperftest -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I../lperf/include -I. -I../lperftest -I. -o main.o ../lperftest/main.cpp
In file included from /usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:41:0,
from /usr/include/c++/4.8/bits/localefwd.h:40,
from /usr/include/c++/4.8/string:43,
from /usr/include/QtCore/qstring.h:54,
from /usr/include/QtCore/qobject.h:48,
from /usr/include/QtCore/QObject:1,
from ../lperftest/main.cpp:9:
/usr/include/c++/4.8/clocale:53:11: error: '::lconv' has not been declared
using ::lconv;
^
/usr/include/c++/4.8/clocale:54:11: error: '::setlocale' has not been declared
using ::setlocale;
^
/usr/include/c++/4.8/clocale:55:11: error: '::localeconv' has not been declared
using ::localeconv;
^
In file included from /usr/include/c++/4.8/bits/localefwd.h:40:0,
from /usr/include/c++/4.8/string:43,
from /usr/include/QtCore/qstring.h:54,
from /usr/include/QtCore/qobject.h:48,
from /usr/include/QtCore/QObject:1,
from ../lperftest/main.cpp:9:
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:52:23: error: 'uselocale' was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:52:45: error: invalid type in declaration before ';' token
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h: In function 'int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)':
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:75:53: error: '__gnu_cxx::__uselocale' cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:100:33: error: '__gnu_cxx::__uselocale' cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
../lperftest/main.cpp: At global scope:
../lperftest/main.cpp:11:5: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char *argv[])
^
../lperftest/main.cpp:11:5: warning: unused parameter 'argv' [-Wunused-parameter]
make: *** [main.o] Error 1
When i try to add iperf3 to the only C++ project all is good. This error exist only in Qt project. Is any idea?
I have the same problem with iperf3 and Qt. Basically it seems that you have to use similar compilation for iperf3 library and your project (both gcc or both g++).
Let us know how it goes. Or share your solution if already done.
-- edit --
or do the following for iperf_api.h
extern "C" {
#include <iperf_api.h>
}
I have the following program for drawing a triangle with vertex arrays, as described in SFML tutorials.
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
try{
sf::RenderWindow Mywindow(sf::VideoMode(800,600),"TriColor Triangle!");
sf::VertexArray triangle(sf::Triangles, 3);
triangle[0].position = sf::Vector2f(5,5);
triangle[1].position = sf::Vector2f(50,5);
triangle[2].position = sf::Vector2f(50,50);
triangle[0].color = sf::Color::Red;
triangle[1].color = sf::Color::Blue;
triangle[2].color = sf::Color::Green;
Mywindow.draw(triangle);
}
catch( const std::runtime_error& e)
{
std::cout << e.what() << std::endl;
std::cin.ignore();
return EXIT_FAILURE;
}
std::cin.ignore();
return EXIT_SUCCESS;
}
The Makefile for compilation I am using is the following:
all: exe
exe: main.o
g++ main.o -o exe -lsfml-graphics -lsfml-window -lsfml-system
main.o: main.cpp
g++ -c main.cpp
The follwing error is being displayed:
make
g++ -c main.cpp
main.cpp: In function ‘int main()’:
main.cpp:11:2: error: ‘VertexArray’ is not a member of ‘sf’
main.cpp:11:18: error: expected ‘;’ before ‘triangle’
main.cpp:13:2: error: ‘triangle’ was not declared in this scope
main.cpp:21:11: error: ‘class sf::RenderWindow’ has no member named ‘draw’
main.cpp:23:33: error: expected unqualified-id before ‘&’ token
main.cpp:23:33: error: expected ‘)’ before ‘&’ token
main.cpp:23:33: error: expected ‘{’ before ‘&’ token
main.cpp:23:35: error: ‘e’ was not declared in this scope
main.cpp:23:36: error: expected ‘;’ before ‘)’ token
make: *** [main.o] Error 1
I don't understand why it is saying VertexArray not member of sf!
You must provide a path to the SFML lib dir and a path to the SFML include dir.
Like this:
"-IC:\\Path\\to\\your\\project\\your-lib-sub-dir\\SFML-2.1\\include"
"-LC:\\Path\\to\\your\\project\\your-lib-sub-dir\\SFML-2.1\\lib"
Another thing, to be able to see something, you should suround your draw call with something like this:
while(1){
Mywindow.clear(sf::Color::Black);
Mywindow.draw(triangle);
Mywindow.display();
}
I am trying to install the MongoDB C++ driver on my machine. I have followed the directions here, and everything seemed to install successfully. Still, I can't seem to include the headers. Here is a simple test program:
#include <cstdlib>
#include <iostream>
#include "mongo/client/dbclient.h"
void run() {
mongo::DBClientConnection c;
c.connect("localhost");
}
int main() {
try {
run();
std::cout << "connected ok" << std::endl;
} catch(const mongo::DBException &e) {
std::cout << "caught" << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
Here are the errors I get:
g++ app/tutorial.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system -o tutorial
app/tutorial.cpp:3:35: error: mongo/client/dbclient.h: No such file or directory
app/tutorial.cpp: In function ‘void run()’:
app/tutorial.cpp:6: error: ‘mongo’ has not been declared
app/tutorial.cpp:6: error: expected `;' before ‘c’
app/tutorial.cpp:7: error: ‘c’ was not declared in this scope
app/tutorial.cpp: In function ‘int main()’:
app/tutorial.cpp:14: error: ISO C++ forbids declaration of ‘mongo’ with no type
app/tutorial.cpp:14: error: expected `)' before ‘::’ token
app/tutorial.cpp:14: error: expected `{' before ‘::’ token
app/tutorial.cpp:14: error: ‘::DBException’ has not been declared
app/tutorial.cpp:14: error: ‘e’ was not declared in this scope
app/tutorial.cpp:14: error: expected `;' before ‘)’ token
Any help would be greatly appreciated.
The line app/tutorial.cpp:3:35: error: mongo/client/dbclient.h: No such file or directory indicates that g++ is having difficulty finding the installed headers. In the tutorial that you linked to, the box below the suggested compilation command states
You may need to use -I and -L to specify the locations of your mongo and boost headers and libraries.
I'll assume that the installation procedure placed your header files in /usr/local/include and libraries (e.g. libmongoclient.a) in /usr/local/lib. Then, try adapting the compilation command to read
g++ -I/usr/local/include -L/usr/local/lib -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system app/tutorial.cpp -o tutorial