chewing / chewing-editor

Cross platform chewing user phrase editor
https://chewing.im/
GNU General Public License v2.0
31 stars 52 forks source link

Cannot build on Mac OS X #121

Closed david50407 closed 8 years ago

david50407 commented 8 years ago
$ make
[  1%] Automatic moc for target chewing-editor
[  1%] Built target chewing-editor_automoc
[  3%] Automatic moc for target exporter
[  3%] Built target exporter_automoc
[  5%] Building CXX object CMakeFiles/exporter.dir/src/exporter/ChewingExporter.cpp.o
In file included from /Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:20:
In file included from /Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:22:
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/UserphraseExporter.h:27:53: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    UserphraseExporter(const UserphraseExporter&) = delete;
                                                    ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/UserphraseExporter.h:28:64: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    UserphraseExporter& operator=(const UserphraseExporter&) = delete;
                                                               ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/UserphraseExporter.h:29:37: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
    virtual ~UserphraseExporter() = default;
                                    ^
In file included from /Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:20:
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:27:23: warning: 'final' keyword is a C++11 extension [-Wc++11-extensions]
class ChewingExporter final: public UserphraseExporter {
                      ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:30:47: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    ChewingExporter(const ChewingExporter&) = delete;
                                              ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:31:58: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    ChewingExporter& operator=(const ChewingExporter&) = delete;
                                                         ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:32:34: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
    virtual ~ChewingExporter() = default;
                                 ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:37:34: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
        const QString& bopomofo) override;
                                 ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.h:38:29: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
    virtual bool saveImpl() override;
                            ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:28:24: error: expected '('
    :UserphraseExporter{path}
                       ^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:28:29: error: expected ';' after expression
    :UserphraseExporter{path}
                            ^
                            ;
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:28:25: warning: expression result unused [-Wunused-value]
    :UserphraseExporter{path}
                        ^~~~
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:29:1: error: expected unqualified-id
{
^
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:52:22: error: expected ';' at end of declaration
    QJsonDocument doc{root};
                     ^
                     ;
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:54:15: error: expected ';' at end of declaration
    QFile file{path_};
              ^
              ;
10 warnings and 5 errors generated.
make[2]: *** [CMakeFiles/exporter.dir/src/exporter/ChewingExporter.cpp.o] Error 1
make[1]: *** [CMakeFiles/exporter.dir/all] Error 2
make: *** [all] Error 2

It seems that clang++ on OS X haven't support some C++11 syntax yet?

clang++ --version:

Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
Chocobo1 commented 8 years ago
/Users/Davy/Code/GitHub/chewing-editor/src/exporter/ChewingExporter.cpp:28:24: error: expected '('
    :UserphraseExporter{path}
                       ^

just replace {} with ()? IMO there exist no reason to use uniform initialization syntax here.

david50407 commented 8 years ago

And clang++ haven't implement noexcept yet...

Chocobo1 commented 8 years ago

maybe it will be possible with gcc on osx: http://braumeister.org/formula/gcc if yes, then the readme.md should be updated.

david50407 commented 8 years ago

@Chocobo1 yes! I got it compiled on my GCC6 on OS X. (I haven't tried other version of GCC)