"unicode identifiers are not supported" when compiling Qt app

Started by
3 comments, last by Koen 19 years, 1 month ago
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.cpp(12) : error C2511: 'EditorTabBar::EditorTabBar(QWidget *)' : overloaded member function not found in 'EditorTabBar'
        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.
Advertisement
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.
<span class="smallfont">That is not dead which can eternal lieAnd with strange aeons even death may die.   -- "The Nameless City" - H. P. Lovecraft</span>
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? ;)
Quote:Original post by Koen
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? ;)


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.
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).

This topic is closed to new replies.

Advertisement