有人能帮我弄清楚为什么我在Clion的编译器中得到这个错误吗?
这是我的CMake文件:
cmake_minimum_required(VERSION 3.25)
project(gtk)
set(CMAKE_CXX_STANDARD 23)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK4 REQUIRED IMPORTED_TARGET gtkmm-4.0)
add_executable(gtk src/main.cpp src/gui.cpp src/gui.hpp src/plot/plotter.cpp src/plot/plotter.hpp src/plot/plotter.cpp src/plot/plotter.hpp src/plot/plottercoords.cpp src/plot/plotterevents.cpp src/plot/plotterlabels.cpp src/plot/plotteroptions.cpp src/plot/plotterseries.cpp src/plot/plotterthemes.cpp src/plot/plotterwidgets.cpp)
target_link_libraries(gtk PRIVATE ${GTK4_LIBRARIES})
target_compile_definitions(gtk PRIVATE ${GTK4_CFLAGS_OTHER})
target_include_directories(gtk PRIVATE ${GTK4_INCLUDE_DIRS})
target_link_directories(gtk PRIVATE ${GTK4_LIBRARY_DIRS})
下面是当我从菜单中“重置缓存并重新加载项目”时的控制台输出。
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -G "CodeBlocks - Unix Makefiles" -S /Users/zenith412/Desktop/Saturn/trexs/gtk -B /Users/zenith412/Desktop/Saturn/trexs/gtk/cmake-build-debug
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/zenith412/Desktop/Saturn/trexs/gtk/cmake-build-debug
Cannot get compiler information:
Compiler exited with error code 1: /usr/local/opt/llvm/bin/clang++ -xc++ -D-mfpmath=sse -D-msse -D-msse2 -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -std=gnu++2b -fpch-preprocess -v -dD -E
Homebrew clang version 16.0.4
Target: x86_64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
(in-process)
"/usr/local/Cellar/llvm/16.0.4/bin/clang-16" -cc1 -triple x86_64-apple-macosx13.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name compiler-file18281748440535425928 -mrelocation-model pic -pic-level 2 -mframe-pointer=all -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=13.3 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -target-linker-version 857.1 -v -fcoverage-compilation-dir=/Users/shivpatel/Desktop/Saturn/trexs/gtk/cmake-build-debug -resource-dir /usr/local/Cellar/llvm/16.0.4/lib/clang/16 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -D -mfpmath=sse -D -msse -D -msse2 -D ___CIDR_DEFINITIONS_END -internal-isystem /usr/local/opt/llvm/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/local/include -internal-isystem /usr/local/Cellar/llvm/16.0.4/lib/clang/16/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include -std=gnu++2b -fdeprecated-macro -fdebug-compilation-dir=/Users/zenith412/Desktop/Saturn/trexs/gtk/cmake-build-debug -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -dD -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o - -x c++ /private/var/folders/dp/14_5b22171nc4l3vwtn3dyv40000gn/T/compiler-file18281748440535425928
clang -cc1 version 16.0.4 based upon LLVM 16.0.4 default target x86_64-apple-darwin22.5.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/opt/llvm/bin/../include/c++/v1
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/local/include
/usr/local/Cellar/llvm/16.0.4/lib/clang/16/include
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/System/Library/Frameworks (framework directory)
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/Library/Frameworks (framework directory)
End of search list.
In file included from <built-in>:461:
<command line>:1:9: error: macro name must be an identifier
#define -mfpmath sse
^
<command line>:2:9: error: macro name must be an identifier
#define -msse 1
^
<command line>:3:9: error: macro name must be an identifier
#define -msse2 1
^
3 errors generated.
[Failed to reload]
我有一种感觉,这个问题来自以下几个方面,但我不知道如何解决它。
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -D -mfpmath=sse -D -msse -D -msse2 -D ___CIDR_DEFINITIONS_END -internal-isystem /usr/local/opt/llvm/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/local/include -internal-isystem /usr/local/Cellar/llvm/16.0.4/lib/clang/16/include -internal-externc-isystem
我重新安装了Xcode,clang,llvm,更新了我的自制软件以及我的MacOS操作系统到最新版本。没有什么能让这个错误消失。我也在终端中运行了conda deactivate
命令。
我想做的主要事情是在我的代码中使用gtkmm4
库。
1条答案
按热度按时间hsvhsicv1#
${GTK4_CFLAGS_OTHER}不是编译定义,而只是编译器选项。
因此,代替:
用途: