<bdo id='Omem0'></bdo><ul id='Omem0'></ul>

  1. <small id='Omem0'></small><noframes id='Omem0'>

    <legend id='Omem0'><style id='Omem0'><dir id='Omem0'><q id='Omem0'></q></dir></style></legend>
    <i id='Omem0'><tr id='Omem0'><dt id='Omem0'><q id='Omem0'><span id='Omem0'><b id='Omem0'><form id='Omem0'><ins id='Omem0'></ins><ul id='Omem0'></ul><sub id='Omem0'></sub></form><legend id='Omem0'></legend><bdo id='Omem0'><pre id='Omem0'><center id='Omem0'></center></pre></bdo></b><th id='Omem0'></th></span></q></dt></tr></i><div id='Omem0'><tfoot id='Omem0'></tfoot><dl id='Omem0'><fieldset id='Omem0'></fieldset></dl></div>
      <tfoot id='Omem0'></tfoot>

    1. CMake 无法确定目标的链接器语言

      CMake cannot determine linker language for target(CMake 无法确定目标的链接器语言)
        <bdo id='YgjHQ'></bdo><ul id='YgjHQ'></ul>

            <small id='YgjHQ'></small><noframes id='YgjHQ'>

              • <i id='YgjHQ'><tr id='YgjHQ'><dt id='YgjHQ'><q id='YgjHQ'><span id='YgjHQ'><b id='YgjHQ'><form id='YgjHQ'><ins id='YgjHQ'></ins><ul id='YgjHQ'></ul><sub id='YgjHQ'></sub></form><legend id='YgjHQ'></legend><bdo id='YgjHQ'><pre id='YgjHQ'><center id='YgjHQ'></center></pre></bdo></b><th id='YgjHQ'></th></span></q></dt></tr></i><div id='YgjHQ'><tfoot id='YgjHQ'></tfoot><dl id='YgjHQ'><fieldset id='YgjHQ'></fieldset></dl></div>
                <tfoot id='YgjHQ'></tfoot>
                  <tbody id='YgjHQ'></tbody>
              • <legend id='YgjHQ'><style id='YgjHQ'><dir id='YgjHQ'><q id='YgjHQ'></q></dir></style></legend>
                本文介绍了CMake 无法确定目标的链接器语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!


                首先,我查看了this 发布后找不到我的问题的解决方案.我正在尝试使用两个头文件在文件夹中设置一个库并与我的主程序链接,在我的文件夹 container 中,它包括:

                To start off, I've taken a look at this post and couldn't find a solution to my problem. I'm attempting to set up a library in a folder using two header files and link with my main program, in my folder container it includes:


                我的容器文件夹中的 CMakeLists.txt 是

                the CMakeLists.txt in my container folder is

                add_library(container linkedQueue.h linkedStack.h)
                install (TARGETS container DESTINATION bin)
                install (FILES linkedQueue.h linkedStack.h DESTINATION include)

                而我在源目录中的 CMakeLists.txt 是:

                while my CMakeLists.txt in the source directory is:

                cmake_minimum_required(VERSION 2.6)
                # set version number
                set (MAJOR 1)
                set (MINOR 0)
                # configure header file to be placed in binary
                # add binary tree to search path for include files
                # so we can find config
                #add container library
                include_directories ("${PROJECT_SOURCE_DIR}/container")
                #add executable
                add_executable(wordLadder ladderMain.cpp)
                target_link_libraries (wordLadder container)
                install (TARGETS wordLadder DESTINATION bin)
                install (FILES "${PROJECT_BINARY_DIR}/ladderConfig.h"
                         DESTINATION include)


                CMake Error: Cannot determine link language for target "container".
                CMake Error: CMake can not determine linker language for target:container
                -- Generating done
                -- Build files have been written to: /home/gmercer/Linux_dev/wordLadder/build

                我不确定我在这里做错了什么,但我认为这与我的库 CMake 文件有关.

                I'm not sure what i'm doing wrong here, but I think it has something to do with my library CMake file.


                您已添加用于创建 container 库的目标.该目标仅包含头文件.请参阅 CMake 文档

                You have added target for creating container library. That target contains only header files. See CMake documentation


                add_library: Add a library to the project using the specified source files.

                add_library( [静态 | 共享 | 模块][EXCLUDE_FROM_ALL]source1 source2 ... sourceN)

                add_library( [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] source1 source2 ... sourceN)

                添加一个库目标,称为从命令调用中列出的源文件构建.对应于逻辑目标名称,并且必须在项目中全局唯一.构建的库的实际文件名是根据本机平台的约定(例如lib.a 或.lib)构建的.

                Adds a library target called to be built from the source files listed in the command invocation. The corresponds to the logical target name and must be globally unique within a project. The actual file name of the library built is constructed based on conventions of the native platform (such as lib.a or .lib).

                但是你不能只从没有任何 cpp 文件的头文件构建库.这就是为什么你会出现这样的错误.

                But you can not build library just from header files without any cpp file. That's why you got such error.

                这篇关于CMake 无法确定目标的链接器语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



                What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                Delay Loading DLLs(延迟加载 DLL)
                Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                Loading a dll from a dll?(从 dll 加载 dll?)
                • <bdo id='KQJgb'></bdo><ul id='KQJgb'></ul>

                  <small id='KQJgb'></small><noframes id='KQJgb'>

                  <legend id='KQJgb'><style id='KQJgb'><dir id='KQJgb'><q id='KQJgb'></q></dir></style></legend>
                  • <i id='KQJgb'><tr id='KQJgb'><dt id='KQJgb'><q id='KQJgb'><span id='KQJgb'><b id='KQJgb'><form id='KQJgb'><ins id='KQJgb'></ins><ul id='KQJgb'></ul><sub id='KQJgb'></sub></form><legend id='KQJgb'></legend><bdo id='KQJgb'><pre id='KQJgb'><center id='KQJgb'></center></pre></bdo></b><th id='KQJgb'></th></span></q></dt></tr></i><div id='KQJgb'><tfoot id='KQJgb'></tfoot><dl id='KQJgb'><fieldset id='KQJgb'></fieldset></dl></div>

                    <tfoot id='KQJgb'></tfoot>

                          <tbody id='KQJgb'></tbody>