floatingonair
floatingonair

Reputation: 53

Why did qt-creator fail to build after I named the widget class with a lower case letter?

I created a widget in the mainwindow and promoted it to my class, the widget was called "renderArea" and I named the class "renderArea" and got bugs. When I renamed the class to "RenderArea" it worked. Any idea why this would cause it to fail?

Upvotes: 0

Views: 96

Answers (1)

Former contributor
Former contributor

Reputation: 2576

The designer (.ui) files are translated to headers (.h) by the "uic" compiler. In the resulting code there is an object variable with the same name of a class. This will produce compiler errors like the ones explained in this SO answer. You can't apply the same solution (adding the class keyword) to your scenario, because the code is auto-generated. But it works when you renamed the class starting with an upper-case, because the names are no longer the same (remember that C and C++ are case-sensitive).

Upvotes: 2

Related Questions