Sign in to follow this  

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

If you intended to correct an error in the post then please contact us.

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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
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.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this