When I use Cmake to compile the file, it shows /usr/bin/ld: cannot find -ltest. However when I use g++ to compile the file, it is ok

前端 未结 1 1794
逝去的感伤
逝去的感伤 2021-01-17 06:25

This is the CMakeList.txt in src directory:

ADD_EXECUTABLE(Expression ExpressionValue.cpp) INCLUDE_DIRECTORIES(/root/fengwu/codes/headfiles/expressi

1条回答
  •  时光说笑
    2021-01-17 06:49

    From the documentation for link_directories:

    The command will apply only to targets created after it is called.

    For make link_directories() call work you need to move it before add_executable().

    0 讨论(0)
提交回复
热议问题