cflags'-Wl,-export-dynamic'vs linker flags'-export-dynamic' [英] cflags '-Wl,-export-dynamic' vs linker flags '-export-dynamic'
问题描述
我使用CMAKE_C_FLAGS = -Wl编译了具有不同编译标志的相同程序(不是库),在CMake中使用Clang
I compiled the same program (not library) with different compilation flags, in CMake with Clang
- export-dynamic
- 使用CMAKE_EXE_LINKER_FLAGS = -export-dynamic
但我注意到方式似乎不工作。我找不到导出的符号。我很惊讶,只有第一路工作。我不知道C编译器做一些棘手的事情,或Clang,或CMake。但是如何让第二种方式工作?
But I noticed that the second way doesn't seem to work. I can't find the exported symbols. I'm so surprised that only the 1st way works. I don't know if the C compilers do something tricky, or Clang, or CMake. But how to let the second way work? The first way would print a lot of warnings.
推荐答案
为第二个变体提供相同的选项。
Provide same options for second variant.
set(CMAKE_EXE_LINKER_FLAGS-Wl,-export-dynamic)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-export-dynamic")
因为编译器和链接器在你的情况下是一样的。
Because compiler and linker the same in your case.
这篇关于cflags'-Wl,-export-dynamic'vs linker flags'-export-dynamic'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!