cc 链接器错误

cc 链接器错误

我正在 Debian 12 上编写一个基于 GTKlibrary 的 C 应用程序。
该程序由由 cmake 生成的 Makefile 构建。
源文件的编译阶段是正确的,但是当链接器被触发时,出现以下错误:

[ 3%] Linking C executable lux
cc: error: -E or -x required when input is from standard input

CMakeLists.txt 文件是:

# Set the name and the supported language of the project
PROJECT(Lux C)
# Set the minimum version of cmake required to build this project
CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)

# Use the package PkgConfig to detect GTK+ headers/library files
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)

set ( ORACLE_LIBS "-locci -lclntsh")
set ( ORACLE_DIR "/opt/oracle/instantclient_19_20")

# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS} ./include ./websocket/include ${ORACLE_DIR}/sdk/include/)
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS} ${ORACLE_DIR})

# Add other flags to the compiler
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})

# Add an executable compiled from *.c
ADD_EXECUTABLE( lux
    main.c log.c 
...
    dbOracle.c
)

# Link the target to the GTK+ libraries
TARGET_LINK_LIBRARIES(lux ${GTK3_LIBRARIES} -lmysqlclient -lcurl -lpthread ${ORACLE_LIBS})

add_compile_options( -rdynamic )

我无法直接控制标志......

相关内容