小编was*_*ful的帖子

如何在MacOS上使用CMake设置多个RPATH目录

我们如何在MacOS上的CMake中设置目标上的多个RPATH目录?在Linux上,我们可以使用以冒号分隔的列表:

set_target_properties(mytarget
    PROPERTIES
    INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/../thirdparty/lib"
)
Run Code Online (Sandbox Code Playgroud)

在MacOS上,我们可以在技术上添加冒号分隔列表并otool -l显示它,但不搜索这些目录:

set_target_properties(mytarget
    PROPERTIES
    INSTALL_RPATH "@loader_path/../lib:@loader_path/../thirdparty/lib"
)
Run Code Online (Sandbox Code Playgroud)

通常情况下,如果我要在MacOS上有多个RPATH目录,我会发送多个链接器标志,这些标志将单独显示otool -l.就像是:

g++-mp-4.7 mytarget.cpp -o mytarget -Wl,-rpath,@loader_path/../lib,-rpath,@loader_path/../thirdparty/lib
Run Code Online (Sandbox Code Playgroud)

这使:

Load command 15
          cmd LC_RPATH
      cmdsize 32
         path @loader_path/../lib (offset 12)
Load command 16
          cmd LC_RPATH
      cmdsize 48
         path @loader_path/../thirdparty/lib (offset 12)
Run Code Online (Sandbox Code Playgroud)

如何使用CMake重新创建此行为?

rpath cmake

5
推荐指数
1
解决办法
3219
查看次数

无法使用 MinGW 和 git bash 在 Windows 上运行 Cmake

我尝试构建gitql

我已经安装了 go、CMake 和 MinGW,并试图让它们在 git bash 下工作,但是当我在 gitql 目录中调用 cmake 时,出现此错误:

-- Building for: NMake Makefiles
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:14 (PROJECT):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler. …
Run Code Online (Sandbox Code Playgroud)

windows gcc cmake gnu-make git-bash

5
推荐指数
1
解决办法
5082
查看次数

如何解决mac中的qt5(找不到包)cmake错误?

在使用CMake构建文件期间出现以下错误:

CMake Warning at CMakeLists.txt:33 (FIND_PACKAGE):

By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake
Run Code Online (Sandbox Code Playgroud)

谁知道怎么解决这个问题?提前致谢

c++ macos qt cmake qt5

4
推荐指数
3
解决办法
9524
查看次数

如何循环遍历Jekyll的_data文件夹中的所有文件?

如何循环遍历 Jekyll 中 _data 文件夹中的每个文件?

目前,我在名为 sidebarlist.yml 的文件中有一个文件列表,如下所示:

- file1
- file2
- file3
Run Code Online (Sandbox Code Playgroud)

为了循环遍历所有这些文件,我使用以下代码:

{% for sidebar in site.data.sidebarlist %}
{% for entry in site.data.sidebars[sidebar].entries %}
...
{% endfor %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

我想避免使用 sidebarlist.yml 并自动迭代 _data 中的所有文件。我可以这样做吗?

liquid jekyll

4
推荐指数
1
解决办法
3582
查看次数

使用 jquery 从复选框中获取标签值

大家好我想使用以下代码捕获标签名称(72 * 30):

$("input[type = 'radio']:checked:last").each(function() {
  var idVal = $(this).attr("id");
  var a = $("label[for='"+idVal+"']").text();
  alert(a);
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li class="radio">
  <input class="tmcp-field nav nav-pills dimension-layer-dimension  tm-epo-field tmcp-radio" type="radio">
  <label id="tmcp_radio_9" >72*30</label>	
  <span class="price tc-price  hidden">
    <span class="amount">20 <i class="fa fa-inr"></i></span>
  </span>		
</li>
Run Code Online (Sandbox Code Playgroud)

但代码没有alert任何意义。怎么了?

html javascript jquery

4
推荐指数
1
解决办法
4393
查看次数

4
推荐指数
2
解决办法
8543
查看次数

我可以复制到多图

鉴于istream_iterator<int>multimap<char, int> output.

我想所有的值复制到output'a'关键.如何处理这个问题的最佳方法是什么?

我试过用:

transform(
    istream_iterator<int>(input),
    istream_iterator<int>(),
    begin(output),
    [](const auto value){
        return make_pair('a', value);
    }
)
Run Code Online (Sandbox Code Playgroud)

但是我收到了错误:

错误:分配只读成员 std::pair<const char, int>::first

我想这意味着我无法写信begin(output).是我唯一的选择for_each吗?

c++ copy insert multimap key-value-store

4
推荐指数
1
解决办法
197
查看次数

如何在Clion和CMake中添加allegro库?

我正在尝试使用Clion IDE编译我的游戏项目但是在移植allegro 5时遇到了问题.我收到此错误:

main.cpp:2:10: fatal error: 'allegro/allegro.h' file not found
   #include <allegro/allegro.h>
Run Code Online (Sandbox Code Playgroud)

我的CMakeLists是:

cmake_minimum_required(VERSION 3.5)
project(testAllegro)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(testAllegro ${SOURCE_FILES})

INCLUDE_DIRECTORIES(  /usr/local/include )
LINK_DIRECTORIES(  /usr/local/lib )

file(GLOB LIBRARIES "/usr/local/Cellar/allegro/5.2.1.1_1/lib/*.dylib")
message("LIBRARIES = ${LIBRARIES}")

TARGET_LINK_LIBRARIES(testAllegro  ${LIBRARIES})
Run Code Online (Sandbox Code Playgroud)

我想问一下如何将外部图书馆的快板添加到Clion?

c++ macos allegro cmake clion

4
推荐指数
1
解决办法
2715
查看次数

错误LNK1104:无法打开文件'Debug\MyProjectLib.lib'

我有以下CMakeLists.txt文件来生成基于Qt的项目:

cmake_minimum_required(VERSION 2.8.12)
project(MyProject)

find_package(Qt5Widgets)

set(MyProjectLib_src ${PROJECT_SOURCE_DIR}/gui.cpp)
set(MyProjectLib_hdr ${PROJECT_SOURCE_DIR}/gui.h)
set(MyProjectLib_ui  ${PROJECT_SOURCE_DIR}/gui.ui)
set(MyProjectBin_src ${PROJECT_SOURCE_DIR}/main.cpp)

qt5_wrap_cpp(MyProjectLib_hdr_moc ${MyProjectLib_hdr})
qt5_wrap_ui (MyProjectLib_ui_moc  ${MyProjectLib_ui})

include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_BINARY_DIR})

add_library(MyProjectLib SHARED 
    ${MyProjectLib_src}
    ${MyProjectLib_hdr_moc}
    ${MyProjectLib_ui_moc}
)
target_link_libraries(MyProjectLib Qt5::Widgets)

add_executable(MyProject ${MyProjectBin_src})
target_link_libraries(MyProject MyProjectLib)
Run Code Online (Sandbox Code Playgroud)

当我尝试编译生成的项目时,我收到以下错误:

错误LNK1104:无法打开文件'Debug\MyProjectLib.lib'

相应的目录Debug包含:

MyPtojectLib.dll
MyProjectLib.ilk
MyProjectLib.pdb
Run Code Online (Sandbox Code Playgroud)

c++ qt cmake qt5

4
推荐指数
1
解决办法
4056
查看次数

徽章不是一个完美的三角形

我写了一个代码来创建一个三角徽章.它几乎正常工作,只有下端有点切断.

这是我的代码:

span {
  border: 1px solid #999;
  border-radius: 5px;
  display: inline-block;
  padding: 3px 8px;
  text-decoration: none;
}

.newBadge {
  border-right: 50px solid transparent !important;
  border-top: 50px solid #777 !important;
  height: 41px !important;
  left: 0px;
  position: absolute;
  top: 0px;
}

.badgeText {
  color: #fff;
  height: 90px;
  left: 0;
  position: absolute;
  top: 0;
  width: 100px;
  height: 90px;
}

.badgeText strong {
  display: block;
  height: 100%;
  left: 37px;
  position: relative;
  -webkit-transform: rotate(-45deg) translate(0, -25%);
  -moz-transform: rotate(-45deg) translate(0, -25%);
  -ms-transform: rotate(-45deg) translate(0, -25%); …
Run Code Online (Sandbox Code Playgroud)

html css

4
推荐指数
1
解决办法
99
查看次数