Problems with compiling in CodeBlocks

Started by Finesio, 28 August 2013, 19:00:08

Finesio

Hi,

I'm using the TGui v0.6 with CodeBlocks 12.11 with TDM-GCC 4.7.1. When I try to build the project I get this errors:

Quote
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|47|warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.hpp|54|error: invalid use of '::'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp||In constructor 'tgui::Callback::Callback()':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|47|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|98|error: 'std::function' has not been declared|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|98|error: expected ',' or '...' before '<' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|137|error: 'std::function' has not been declared|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|137|error: expected ',' or '...' before '<' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|204|error: 'function' in namespace 'std' does not name a type|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|204|error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive]|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|204|error: expected ',' or '...' before '<' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: 'function' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: 'function' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: a call to a constructor cannot appear in a constant-expression|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: template argument 1 is invalid|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: template argument 2 is invalid|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: template argument 2 is invalid|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|210|error: template argument 4 is invalid|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp||In member function 'void tgui::CallbackManager::bindCallback(void (T::*)(), T*, unsigned int)':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|120|error: 'bind' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp||In member function 'void tgui::CallbackManager::bindCallbackEx(void (T::*)(const tgui::Callback&), T*, unsigned int)':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|159|error: 'bind' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Callback.hpp|159|error: 'ref' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|315|error: 'std::function' has not been declared|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|315|error: expected ',' or '...' before '<' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|460|error: 'function' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|460|error: 'function' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|460|error: template argument 1 is invalid|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|460|error: template argument 2 is invalid|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|460|error: expected unqualified-id before '>' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp||In member function 'void tgui::Container::bindGlobalCallback(void (T::*)(const tgui::Callback&), T*)':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|331|error: 'm_GlobalCallbackFunctions' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|331|error: 'bind' is not a member of 'std'|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Container.hpp|331|error: 'std::placeholders' has not been declared|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Panel.hpp|117|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\ChildWindow.hpp|159|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Gui.hpp|341|error: 'std::function' has not been declared|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\Gui.hpp|341|error: expected ',' or '...' before '<' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr()':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|42|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|50|error: expected constructor, destructor, or type conversion before '(' token|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr(tgui::Gui&, const sf::String&)':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|61|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr(tgui::Container&, const sf::String&)':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|71|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In member function 'void tgui::SharedWidgetPtr<T>::reset()':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|161|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In member function 'bool tgui::SharedWidgetPtr<T>::operator!() const':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|181|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In member function 'T& tgui::SharedWidgetPtr<T>::operator*() const':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|223|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In member function 'T* tgui::SharedWidgetPtr<T>::operator->() const':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|232|error: 'nullptr' was not declared in this scope|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl||In member function 'tgui::SharedWidgetPtr<U> tgui::SharedWidgetPtr<T>::clone() const':|
..\..\TGUI\TGUI-0.6-alpha1\include\TGUI\SharedWidgetPtr.inl|257|error: 'nullptr' was not declared in this scope|
||=== Build finished: 45 errors, 1 warnings (0 minutes, 1 seconds) ===|

Don't know what's wrong with it. Can you help me?

texus

#1
I know it is easy to overlook, but it's in the tutorial.
QuoteWhen using TGUI v0.6, make sure to check the "-std=c++0x" or "-std=c++11" compiler flag.

Bineet

Though I am a newbie in C++, I had encountered the same problem as I got an error message "nullptr is not defined in this scope." Please consider trying NULL instead of nullptr, as it resolved my problem. No special header file is required for this.

texus

I assume that my previous message contained an empty quote for u too? It apparently contained an unknown character and no longer showed up here (unlike when that post was created half a year ago).

You should add the "-std=c++11" compiler flag (or "-std=c++0x" if you don't have that option) to your project.