[SOLVED] Compiling error with Codeblocks

telchar

23-01-2009 18:38:50

Hi there,

i'm willing to try MyGUI into my project, but i get some errors when i try to compile it with Code::Blocks (8.02):

include\MyGUI_Widget.h|137|error: expected unqualified-id before '&' token|
include\MyGUI_Widget.h|137|error: expected `,' or `...' before '&' token|
include\MyGUI_Widget.h|137|error: ISO C++ forbids declaration of `parameter' with no type|
include\MyGUI_Widget.h|139|error: ISO C++ forbids declaration of `UTFString' with no type|
include\MyGUI_Widget.h|139|error: invalid use of `::'|
include\MyGUI_Widget.h|139|error: `UTFString' declared as a `virtual' field|
include\MyGUI_Widget.h|139|error: expected `;' before '&' token|
||=== Build finished: 7 errors, 0 warnings ===|


At line 137 there is:
virtual void setCaption(const Ogre::UTFString & _caption);
and at line 139: virtual const Ogre::UTFString & getCaption();

In BuildOptions > Search Directories i added those lines:
for "Compiler" and "Resource Compiler":
- $(OGRE_HOME)\include
- $(OGRE_HOME)\Samples\include
- include
- src
for "Linker": $(OGRE_HOME)\bin\debug

Any idea of what is the problem here ?

Five_stars

23-01-2009 19:34:03

Codeblocks project file can be out-of-date.
Because no one from MyGUI developers don't use it. And this file is updating by community... not so often :) .

But I think, it's strange errors for that. Do you use MyGUI from SVN?

telchar

23-01-2009 19:56:41

Nop i downloaded the 2.2.0_RC1 package
I'll try with the head revision

telchar

23-01-2009 20:18:15

I got pretty much de same errors with the SVN version

Here comes the compilation log from code::blocks

Compiling: src\MyGUI_ActionController.cpp
In file included from E:/OgreSDK/include/OgreMemoryAllocatorConfig.h:189,
from E:/OgreSDK/include/OgrePrerequisites.h:409,
from include/MyGUI_Prerequest.h:32,
from include/MyGUI_Precompiled.h:10,
from E:\dependances\mygui\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
E:/OgreSDK/include/OgreMemoryStdAlloc.h: In static member function `static void* Ogre::StdAlignedAllocPolicy<Alignment>::allocateBytes(size_t, const char*, int, const char*)':
E:/OgreSDK/include/OgreMemoryStdAlloc.h:116: warning: statement has no effect
E:/OgreSDK/include/OgreMemoryStdAlloc.h:116: warning: statement has no effect
E:/OgreSDK/include/OgreMemoryStdAlloc.h:116: warning: statement has no effect
In file included from include/MyGUI_IResource.h:12,
from include/MyGUI_Precompiled.h:17,
from E:\dependances\mygui\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
include/MyGUI_XmlDocument.h: At global scope:
include/MyGUI_XmlDocument.h:272: error: expected unqualified-id before '&' token
include/MyGUI_XmlDocument.h:272: error: expected `,' or `...' before '&' token
include/MyGUI_XmlDocument.h:273: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_XmlDocument.h:277: error: expected unqualified-id before '&' token
include/MyGUI_XmlDocument.h:277: error: expected `,' or `...' before '&' token
include/MyGUI_XmlDocument.h:278: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_XmlDocument.h: In member function `bool MyGUI::xml::Document::save(int)':
include/MyGUI_XmlDocument.h:274: error: `_filename' was not declared in this scope
include/MyGUI_XmlDocument.h:274: warning: unused variable '_filename'
include/MyGUI_XmlDocument.h: In member function `bool MyGUI::xml::Document::open(int)':
include/MyGUI_XmlDocument.h:279: error: `_filename' was not declared in this scope
include/MyGUI_XmlDocument.h:279: warning: unused variable '_filename'
include/MyGUI_XmlDocument.h: In member function `void MyGUI::xml::Document::setLastFileError(const std::wstring&)':
include/MyGUI_XmlDocument.h:297: error: `UTFString' is not a member of `Ogre'
In file included from include/MyGUI_Widget.h:15,
from include/MyGUI_CastWidget.h:11,
from include/MyGUI_Precompiled.h:30,
from E:\dependances\mygui\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
include/MyGUI_ISubWidgetText.h: At global scope:
include/MyGUI_ISubWidgetText.h:75: error: expected unqualified-id before '&' token
include/MyGUI_ISubWidgetText.h:75: error: expected `,' or `...' before '&' token
include/MyGUI_ISubWidgetText.h:75: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_ISubWidgetText.h:76: error: ISO C++ forbids declaration of `UTFString' with no type
include/MyGUI_ISubWidgetText.h:76: error: invalid use of `::'
include/MyGUI_ISubWidgetText.h:76: error: `UTFString' declared as a `virtual' field
include/MyGUI_ISubWidgetText.h:76: error: expected `;' before '&' token
include/MyGUI_ISubWidgetText.h:78: error: expected `;' before "virtual"
In file included from include/MyGUI_CastWidget.h:11,
from include/MyGUI_Precompiled.h:30,
from E:\dependances\mygui\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
include/MyGUI_Widget.h:134: error: expected unqualified-id before '&' token
include/MyGUI_Widget.h:134: error: expected `,' or `...' before '&' token
include/MyGUI_Widget.h:134: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_Widget.h:136: error: ISO C++ forbids declaration of `UTFString' with no type
include/MyGUI_Widget.h:136: error: invalid use of `::'
include/MyGUI_Widget.h:136: error: `UTFString' declared as a `virtual' field
include/MyGUI_Widget.h:136: error: expected `;' before '&' token

Altren

23-01-2009 22:18:19

Hm, looks like your path to Ogre is incorrect or you don't have Ogre::UTFString in your Ogre version.

telchar

24-01-2009 00:06:53

The path is correct. It works fine with my project.

It seems i don't have UTFString has you say. i'm using the Ogre Precompiled SDK for Code::Blocks, is that normal ?

Altren

24-01-2009 01:07:04

Yes, what version of Ogre?

telchar

24-01-2009 01:17:06

Ogre 1.6.1

Willikus

24-01-2009 15:42:37

Hi!
(in little english)

We'd like to use myGui in our project and we met the same problem as Telchar.
Here is differents information and tests done :
-We use Ogre 1.4.9 Compiled with GCC (not pre-compiled)
-We use Code::Block 8.02 with last MinGW pack and last toolbox C++

-Same error with OgreUTFString: we have the file with the correct path (OgreSDK/include/OgreUTFString.h)
-Same error with myGUI 2.00/2.2

Thank,

W

Altren

24-01-2009 16:20:14

All this errors appears when you don't have right paths to Ogre.

Just downloaded old MyGUI (2.2_RC1) and it compiled fine without any changes.
Looks like you guys don't have $(OGRE_HOME) variable or defined different way. We assume that $(OGRE_HOME) is folder where you have folders like OgreMain and Dependencies.

telchar

24-01-2009 16:32:48

Well my OGRE_HOME environment variable points on: e:\OgreSDK where the SDK is installed ...

Willikus

24-01-2009 16:46:00

Mhmm I think that I have correctly paths...

On SVN version.

Search Directory - Compiler:
OgreSDK/include
OgreSDK/Dependencies/include
OgreSDK/Dependencies/include/freetype

Search Directory - Linker:
OgreSDK/lib

Link :
OgreMain
libfreetype230.a (for freetype6)
ole32

The project compil but...
-------------- Build: Windows_Release in MyGUIEngine ---------------

Compiling: src\MyGUI_ActionController.cpp
In file included from include/MyGUI_IResource.h:12,
from include/MyGUI_Precompiled.h:17,
from G:\OgrePlug\MyGUI\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
include/MyGUI_XmlDocument.h:272: error: expected unqualified-id before '&' token
include/MyGUI_XmlDocument.h:272: error: expected `,' or `...' before '&' token
include/MyGUI_XmlDocument.h:273: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_XmlDocument.h:277: error: expected unqualified-id before '&' token
include/MyGUI_XmlDocument.h:277: error: expected `,' or `...' before '&' token
include/MyGUI_XmlDocument.h:278: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_XmlDocument.h: In member function `bool MyGUI::xml::Document::save(int)':
include/MyGUI_XmlDocument.h:274: error: `_filename' was not declared in this scope
include/MyGUI_XmlDocument.h:274: warning: unused variable '_filename'
include/MyGUI_XmlDocument.h: In member function `bool MyGUI::xml::Document::open(int)':
include/MyGUI_XmlDocument.h:279: error: `_filename' was not declared in this scope
include/MyGUI_XmlDocument.h:279: warning: unused variable '_filename'
include/MyGUI_XmlDocument.h: In member function `void MyGUI::xml::Document::setLastFileError(const std::wstring&)':
include/MyGUI_XmlDocument.h:297: error: `UTFString' is not a member of `Ogre'
In file included from include/MyGUI_Widget.h:15,
from include/MyGUI_CastWidget.h:11,
from include/MyGUI_Precompiled.h:30,
from G:\OgrePlug\MyGUI\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
include/MyGUI_ISubWidgetText.h: At global scope:
include/MyGUI_ISubWidgetText.h:75: error: expected unqualified-id before '&' token
include/MyGUI_ISubWidgetText.h:75: error: expected `,' or `...' before '&' token
include/MyGUI_ISubWidgetText.h:75: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_ISubWidgetText.h:76: error: ISO C++ forbids declaration of `UTFString' with no type
include/MyGUI_ISubWidgetText.h:76: error: invalid use of `::'
include/MyGUI_ISubWidgetText.h:76: error: `UTFString' declared as a `virtual' field
include/MyGUI_ISubWidgetText.h:76: error: expected `;' before '&' token
include/MyGUI_ISubWidgetText.h:78: error: expected `;' before "virtual"
In file included from include/MyGUI_CastWidget.h:11,
from include/MyGUI_Precompiled.h:30,
from G:\OgrePlug\MyGUI\trunk\MyGUIEngine\src\MyGUI_ActionController.cpp:8:
include/MyGUI_Widget.h:143: error: expected unqualified-id before '&' token
include/MyGUI_Widget.h:143: error: expected `,' or `...' before '&' token
include/MyGUI_Widget.h:143: error: ISO C++ forbids declaration of `parameter' with no type
include/MyGUI_Widget.h:145: error: ISO C++ forbids declaration of `UTFString' with no type
include/MyGUI_Widget.h:145: error: invalid use of `::'
include/MyGUI_Widget.h:145: error: `UTFString' declared as a `virtual' field
include/MyGUI_Widget.h:145: error: expected `;' before '&' token
Process terminated with status 1 (0 minutes, 3 seconds)
24 errors, 2 warnings


An other idea ?

Willikus

24-01-2009 18:39:35

I have compil MyGUI...

it is necessary to install the Toolbox : http://downloads.sourceforge.net/ogre/M ... g_mirror=1

I didn't arrive because the MingW folder of C::B been wrong. (Settings/Compiler And Debugguer/ Toolchain executable)

EDIT : and recompil Ogre ;)

telchar

24-01-2009 19:52:39

The toolbox solved my problem, i must have forgot to reinstall it last week when i reinstalled my OS.
Anyway, thanks a lot Willikus !