I have a project ( full code here ) that uses the following toolchain:
- OSX 10.10.5 (Yosemite)
- C ++ 11 (apparently has better compiler support than C ++ 14)
- Qt 5.5.0 (cross-platform graphics library)
- Qt Creator 3.5.0 (IDE tightly integrated with Qt)
- QMake (a build tool that is tightly integrated with Qt)
- Clang 6.0 64-bit (default compiler when using Qt Creator on OSX)
- Xcode 6.1.1 (another OSX IDE that Clang seems to include)
The problem occurs when I try to create a project. It is worth noting that the exact same code and project file are compiled and linked without any errors or warnings when I use Windows 7 instead of OSX and MingW / GCC instead of Xcode / Clang. It is also worth noting that this exact set of tools worked a few months ago when I last developed on my OSX machine. If I were to guess, I would say that adding the line "CONFIG + = C ++ 11" to the project file is what caused the problem (it was not possible to delete it now without causing other problems). The following is an example output:
09:06:44: Running steps for project AISweeper... 09:06:44: Starting: "/usr/bin/make" clean rm -f qrc_sweeper_resources.cpp rm -f moc_player_abstract.cpp moc_player_human.cpp moc_player_machine_learning_ai.cpp moc_player_probability_based_ai.cpp moc_player_random_action_ai.cpp moc_sweeper_batch_manager.cpp moc_sweeper_batch_settings.cpp moc_sweeper_batch_status.cpp moc_sweeper_control_window.cpp moc_sweeper_game.cpp moc_sweeper_widget.cpp rm -f ui_sweeper_control_window.h rm -f player_abstract.o player_human.o player_machine_learning_ai.o player_probability_based_ai.o player_random_action_ai.o sweeper_batch_manager.o sweeper_batch_settings.o sweeper_batch_status.o sweeper_common_functions.o sweeper_control_window.o sweeper_game.o sweeper_main.o sweeper_model.o sweeper_node.o sweeper_widget.o qrc_sweeper_resources.o moc_player_abstract.o moc_player_human.o moc_player_machine_learning_ai.o moc_player_probability_based_ai.o moc_player_random_action_ai.o moc_sweeper_batch_manager.o moc_sweeper_batch_settings.o moc_sweeper_batch_status.o moc_sweeper_control_window.o moc_sweeper_game.o moc_sweeper_widget.o rm -f *~ core *.core 09:06:44: The process "/usr/bin/make" exited normally. 09:06:44: Configuration unchanged, skipping qmake step. 09:06:44: Starting: "/usr/bin/make" /Users/alexjohnson/Qt/5.5/clang_64/bin/uic ../AISweeper/ui/sweeper_control_window.ui -o ui_sweeper_control_window.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../AISweeper -I. -I../../../Qt/5.5/clang_64/lib/QtWidgets.framework/Headers -I../../../Qt/5.5/clang_64/lib/QtGui.framework/Headers -I../../../Qt/5.5/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../../Qt/5.5/clang_64/mkspecs/macx-clang -F/Users/alexjohnson/Qt/5.5/clang_64/lib -o player_abstract.o ../AISweeper/src/players/player_abstract.cpp *snip* /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../AISweeper -I. -I../../../Qt/5.5/clang_64/lib/QtWidgets.framework/Headers -I../../../Qt/5.5/clang_64/lib/QtGui.framework/Headers -I../../../Qt/5.5/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../../Qt/5.5/clang_64/mkspecs/macx-clang -F/Users/alexjohnson/Qt/5.5/clang_64/lib -o moc_sweeper_game.o moc_sweeper_game.cpp /Users/alexjohnson/Qt/5.5/clang_64/bin/moc -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D__APPLE__ -D__GNUC__=4 -D__APPLE_CC__ -I/Users/alexjohnson/Qt/5.5/clang_64/mkspecs/macx-clang -I/Users/alexjohnson/WORKSPACE_ASJ/GitHub/AISweeper -I/Users/alexjohnson/Qt/5.5/clang_64/lib/QtWidgets.framework/Headers -I/Users/alexjohnson/Qt/5.5/clang_64/lib/QtGui.framework/Headers -I/Users/alexjohnson/Qt/5.5/clang_64/lib/QtCore.framework/Headers -I. -F/Users/alexjohnson/Qt/5.5/clang_64/lib ../AISweeper/inc/sweeper_widget.h -o moc_sweeper_widget.cpp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../AISweeper -I. -I../../../Qt/5.5/clang_64/lib/QtWidgets.framework/Headers -I../../../Qt/5.5/clang_64/lib/QtGui.framework/Headers -I../../../Qt/5.5/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../../Qt/5.5/clang_64/mkspecs/macx-clang -F/Users/alexjohnson/Qt/5.5/clang_64/lib -o moc_sweeper_widget.o moc_sweeper_widget.cpp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -stdlib=libc++ -mmacosx-version-min=10.7 -Wl,-rpath,/Users/alexjohnson/Qt/5.5/clang_64/lib -o AISweeper.app/Contents/MacOS/AISweeper AISweeper player_abstract.o player_human.o player_machine_learning_ai.o player_probability_based_ai.o player_random_action_ai.o sweeper_batch_manager.o sweeper_batch_settings.o sweeper_batch_status.o sweeper_common_functions.o sweeper_control_window.o sweeper_game.o sweeper_main.o sweeper_model.o sweeper_node.o sweeper_widget.o qrc_sweeper_resources.o moc_player_abstract.o moc_player_human.o moc_player_machine_learning_ai.o moc_player_probability_based_ai.o moc_player_random_action_ai.o moc_sweeper_batch_manager.o moc_sweeper_batch_settings.o moc_sweeper_batch_status.o moc_sweeper_control_window.o moc_sweeper_game.o moc_sweeper_widget.o -F/Users/alexjohnson/Qt/5.5/clang_64/lib -stdlib=libc++ -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL clang: error: no such file or directory: 'AISweeper' make: *** [AISweeper.app/Contents/MacOS/AISweeper] Error 1 09:07:03: The process "/usr/bin/make" exited with code 2. Error while building/deploying project AISweeper (kit: Desktop Qt 5.5.0 clang 64bit) When executing step "Make" 09:07:03: Elapsed time: 00:19.
I find it difficult to interpret all this, but I believe that this means that Clang does not find the AISweeper directory inside the generated application when linking (hence all the mentioned .o files). This seems to be controlled by the TARGET variable in the QMake project file. If I change this variable from "AISweeper" to "Foo", then it will not be able to find the directory "Foo". After manually checking the generated application, I can confirm that there is "/Users/alexjohnson/WORKSPACE_ASJ/GitHub/build-AISweeper-Desktop_Qt_5_5_0_clang_64bit-Debug/AISweeper.app/Contents/MacOS/", but it does not have an AIS directory inside it. I am not sure how to ensure its existence as part of the assembly process. I also tried abandoning Clang and switching to GCC, but this led to incompatibility issues between C ++ 11, OSX and Qt. I tried a problem with Google, but most of the time this error occurs when Clang cannot find third-party libraries. In my case, it does not seem to be able to find my project directory. I saw some mention of opening a project in Xcode and changing some parameters there, but I could not open my project directly with Xcode or find any of the settings mentioned. Here is the contents of my QMake project file (AISweeper.pro), if there is anything else that I should try changing here:
CONFIG += \ c++11 FORMS += \ ui/sweeper_control_window.ui HEADERS += \ inc/players/player_abstract.h \ inc/players/player_human.h \ inc/players/player_machine_learning_ai.h \ inc/players/player_probability_based_ai.h \ inc/players/player_random_action_ai.h \ inc/sweeper_batch_manager.h \ inc/sweeper_batch_settings.h \ inc/sweeper_batch_status.h \ inc/sweeper_common_functions.h \ inc/sweeper_control_window.h \ inc/sweeper_game.h \ inc/sweeper_model.h \ inc/sweeper_node.h \ inc/sweeper_widget.h QT += \ core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets LIBS += \ -stdlib=libc++ RESOURCES += \ rsc/sweeper_resources.qrc SOURCES += \ src/players/player_abstract.cpp \ src/players/player_human.cpp \ src/players/player_machine_learning_ai.cpp \ src/players/player_probability_based_ai.cpp \ src/players/player_random_action_ai.cpp \ src/sweeper_batch_manager.cpp \ src/sweeper_batch_settings.cpp \ src/sweeper_batch_status.cpp \ src/sweeper_common_functions.cpp \ src/sweeper_control_window.cpp \ src/sweeper_game.cpp \ src/sweeper_main.cpp \ src/sweeper_model.cpp \ src/sweeper_node.cpp \ src/sweeper_widget.cpp TARGET += \ AISweeper TEMPLATE += \ app
What else can I do to solve this problem? I just want these tools to play well with each other and my project so that I can get back to coding!
source share