【发布时间】:2021-07-12 19:50:56
【问题描述】:
我正在使用 clion 开发一个 c++ 项目,使用 capstone,但我确实不太了解 cmake 语法 有我的项目树 enter image description here
在 main.cpp 中使用了一个函数(称为 a()),在 cstool.h 中声明并在 cstool.cpp 中实现
并且a()中用到了函数print_insn_detail_arm(),print_insn_detail_arm64(),print_insn_detail_x86(),
print_insn_detail_arm() implemented in cstool_arm.c
print_insn_detail_arm64() implemented in cstool_arm64.c
print_insn_detail_x86() implemented in cstool_x86.c
no header files for the three .c files
但是编译时出错
我认为libcstool_arch.a没有链接到项目,但我不知道如何写正确的句子。
不确定这三个.c文件是否需要头文件
我觉得cmake的句序等方面可能有一些错误或者思路不完善,希望初学者指导和建议
【问题讨论】:
-
欢迎来到 Stack Overflow。在这里,我们不喜欢只包含 code 或/和 错误消息 的 images。相反,我们希望这些内容以 text 的形式包含在问题帖子中。请阅读How to Ask 并相应地更新您的问题。
-
CMake 对我来说看起来不错。由于您在没有头文件的情况下使用这些函数,我假设您对这些函数进行了一些外部/前向声明?也许参数类型与预期不匹配?
-
您好!静态库与 CMake 的链接可以参考this 帖子。