# "unicode identifiers are not supported" when compiling Qt app

This topic is 4661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am trying to use the following c++ class in a Qt application header:
//-----------------------------------------------------------------------------
#pragma once

#include <qtabwidget.h>

class EditorTabBar : public QTabWidget
{
Q_OBJECT
public:

EditorTabBar( QWidget * ip_parent );

};

//-----------------------------------------------------------------------------


source:
//-----------------------------------------------------------------------------
#include "EditorTabBar.h"

EditorTabBar::EditorTabBar(QWidget* ip_parent):
QTabWidget(ip_parent, 0, 0)
{
}

//-----------------------------------------------------------------------------


If I compile this code, visual studio gives the following errors:
EditorTabBar.h(19) : error C2460: 'EditorTabBar::QWidget*ip_parent' : uses 'EditorTabBar', which is being defined
EditorTabBar.h(14) : see declaration of 'EditorTabBar'
EditorTabBar.cpp(12) : error C3209: 'ip_parent' : Unicode identifiers are not yet supported
EditorTabBar.h(14) : see declaration of 'EditorTabBar'
EditorTabBar.cpp(18) : fatal error C1004: unexpected end of file found


First I posted this question on qtforum.org, but there someone suggested this is probably not something Qt specific. Still I find it strange that the compiler complains about 'EditorTabBar::QWidget*ip_parent' while the code should be 'EditorTabBar(QWidget * ip_parent)'. Since the moc preprocesses header files, I suspected this might be the cause... Sometimes similar classes (inheriting from QObject, QWidget,...) do compile after playing a bit with whitespaces and 'layout' of the source code. Anyone a clue about what goes wrong? Thanks.

##### Share on other sites
OK. I was able to reproduce the error. Try going into where ip_parent is declared, manually copy it verbatum (don't copy and paste), and delete the old declaration. It appears that the identifier ip_parent contains unicode characters and that just won't work.

Hope that helps.

##### Share on other sites
That helps a lot! Thank you very much. It compiles fine now. But the only thing I can say is: "what the fuck?!" How did those characters get in there, and why didn't I see them in visual studio?
And if I may be so curious, where did you get the idea for such a solution? ;)

##### Share on other sites
Quote:
 Original post by KoenThat helps a lot! Thank you very much. It compiles fine now. But the only thing I can say is: "what the fuck?!" How did those characters get in there, and why didn't I see them in visual studio?And if I may be so curious, where did you get the idea for such a solution? ;)

He has the mind of a genius [wink]. The only thing I can think of is if you copy pasted from a web page or you opened a project that someone made that did the same. This is something very strange that I've never heard of. MSDN does not have that much to say about it.

##### Share on other sites
All the code was hand typed by me. No copying/pasting, no other computers/compilers/editors involved here. The strange thing is it only happens with Qt projects... And if I open the files in notepad they still look ok. I still blame the moc :) Though it shouldn't touch my own source files (except for reading, that is).

##### Share on other sites

This topic is 4661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628682
• Total Posts
2984189

• 13
• 12
• 9
• 10
• 10