nurupo / ProjectTox-Qt-GUI

A cross-platform front end for ProjectTox Core library, written in C++11 with use of Qt5
GNU General Public License v3.0
341 stars 116 forks source link

Fix compilation error #111

Closed Ansa89 closed 10 years ago

Ansa89 commented 10 years ago

Environment:

On given environment, that piece of code fails building: g++ -c -pipe -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt5.2.0/5.2.0/gcc/mkspecs/linux-g++ -I../projectfiles/QtCreator -I../src -I../submodules/ProjectTox-Core/toxcore -I/opt/Qt5.2.0/5.2.0/gcc/include -I/opt/Qt5.2.0/5.2.0/gcc/include/QtWidgets -I/opt/Qt5.2.0/5.2.0/gcc/include/QtGui -I/opt/Qt5.2.0/5.2.0/gcc/include/QtCore -I. -I. -o main.o ../src/main.cpp In file included from ../src/ouruseritemwidget.hpp:20:0, from ../src/mainwindow.hpp:22, from ../src/starter.hpp:20, from ../src/main.cpp:17: ../src/editablelabelwidget.hpp:33:29: error: expected ‘;’ at end of member declaration ../src/editablelabelwidget.hpp:33:31: error: ‘override’ does not name a type make: *\ [main.o] Error 1

nurupo commented 10 years ago

override is a valid C++11, g++ 4.6.3 just doesn't support it, update to either 4.7 or 4.8.

Ansa89 commented 10 years ago

I can't update gcc. I will close the pull request as it's more my fault than your, and keep remove the "override" on my local clone.

nurupo commented 10 years ago

@Ansa89 That's strange that your compiler doesn't bark on the other overrides that are in the code, like here, or here, or even here.

The time of your issue matched the time when I updated that exact file that you had issues with, the editablelabelwidget.hpp, so I assume you already had other source files compiled into object files by a compiler that supports C++11 overrides, then you pulled my updates, changed the compiler on the one that doesn't support C++11 overrides, and the compiler, being smart enough, tried to compile only modified source files, that's why it barked only on that single override and no others.

Did the C++11-compliant compiler not suit your needs that you have changed it? : )

Ansa89 commented 10 years ago

That's not exact: I always do a "make clean" and start from the ground with the new compilation. This issue was here since the beginning (from the first clone, I always removed that "override" in order to compile).

Checking the other files ("src/elidelabel.hpp" and "src/esclineedit.hpp"), I noticed I had modified those as well (my fault not reporting that).

For these reasons I think I never had a C++11-compliant compiler (and ATM I'm unable to update the current compiler).

nurupo commented 10 years ago

I see, than that means that gcc 4.6 already implements some of C++11 features, because there are a lot more of those than four overrides used in the code; good that you didn't have to change all of them : )

Ansa89 commented 10 years ago

Yes, I was lucky.