小编Tad*_*Tad的帖子

提升记录器链接问题

我正在编写一个使用Boost库的程序.我没有链接和使用程序选项的问题,但我似乎无法使升压日志正常工作.谁能告诉我我错过了什么?

jamroot.jam

using clang : : : <compileflags>-Isrc/main/headers <compileflags>-std=c++11 <compileflags>-stdlib=libc++ <linkflags>-std=c++11 <linkflags>-stdlib=libc++ ;
lib boost_program_options boost_log ;
exe foghorn : [ glob src/main/cpp/*.cpp ] boost_program_options boost_log ;
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

  "boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)", referenced from:
      boost::log::v2s_mt_posix::record::reset() in main.o
  "boost::log::v2s_mt_posix::attribute_set::insert(boost::log::v2s_mt_posix::attribute_name, boost::log::v2s_mt_posix::attribute const&)", referenced from:
      boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger<ESeverityLevel>, boost::log::v2s_mt_posix::sources::single_thread_model>::add_attribute_unlocked(boost::log::v2s_mt_posix::attribute_name const&, boost::log::v2s_mt_posix::attribute const&) in main.o
      boost::log::v2s_mt_posix::aux::attribute_set_reference_proxy::operator=(boost::log::v2s_mt_posix::attribute const&) const in main.o
  "boost::log::v2s_mt_posix::attribute_set::attribute_set(boost::log::v2s_mt_posix::attribute_set const&)", referenced from:
      boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger<ESeverityLevel>, boost::log::v2s_mt_posix::sources::single_thread_model>::basic_logger(boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger<ESeverityLevel>, boost::log::v2s_mt_posix::sources::single_thread_model> const&) in main.o
  "boost::log::v2s_mt_posix::attribute_set::attribute_set()", referenced from:
      boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger<ESeverityLevel>, boost::log::v2s_mt_posix::sources::single_thread_model>::basic_logger() in main.o
  "boost::log::v2s_mt_posix::attribute_set::~attribute_set()", referenced from:
      boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::severity_logger<ESeverityLevel>, boost::log::v2s_mt_posix::sources::single_thread_model>::~basic_logger() in …
Run Code Online (Sandbox Code Playgroud)

c++ logging boost c++11

16
推荐指数
2
解决办法
1万
查看次数

计算和绘制矢量字段

我正在尝试使用以下公式为给定对象绘制潜在字段:

U=-?_goal*e^(-((x-x_goal )^2/a_goal +(y-y_goal^2)/b_goal ) )
Run Code Online (Sandbox Code Playgroud)

使用以下代码

    # Set limits and number of points in grid
    xmax = 10.0
    xmin = -xmax
    NX = 20
    ymax = 10.0
    ymin = -ymax
    NY = 20
    # Make grid and calculate vector components
    x = linspace(xmin, xmax, NX)
    y = linspace(ymin, ymax, NY)
    X, Y = meshgrid(x, y)
    x_obstacle = 0
    y_obstacle = 0
    alpha_obstacle = 1
    a_obstacle = 1
    b_obstacle = 1
    P = -alpha_obstacle * exp(-(X - x_obstacle)**2 / a_obstacle …
Run Code Online (Sandbox Code Playgroud)

python numpy

14
推荐指数
1
解决办法
2万
查看次数

Java 8 range()列表?

for (final A a : listOfAs.getList()) {
 do something (if statement), not using a
}
Run Code Online (Sandbox Code Playgroud)

有没有办法在Java 8中改进此代码?即我想执行一些事情,因为列表中有多少元素,但我不会在循环内部使用元素.例如,python有

for _ in range(n):
Run Code Online (Sandbox Code Playgroud)

Java 8中有类似的东西吗?

谢谢.

java java-8

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

Apache Commons CLI参数值

我正在尝试编写一个程序,执行时java -jar -cf file.txt将检索cf参数的值.我到目前为止的代码是:

Options options = new Options();

final Option configFileOption = Option.builder("cf")
                        .longOpt("configfile")
                        .desc("Config file for Genome Store").argName("cf")
                        .build();

options.addOption(configFileOption);

CommandLineParser cmdLineParser = new DefaultParser();
CommandLine commandLineGlobal= cmdLineParser.parse(options, commandLineArguments);

if(commandLineGlobal.hasOption("cf")) {
        System.out.println(commandLineGlobal.getOptionValue("cf"));
    }
Run Code Online (Sandbox Code Playgroud)

我面临的问题是正在打印的值为null.谁能告诉我我错过了什么?

apache-commons-cli

2
推荐指数
1
解决办法
3917
查看次数

在Java中使用try with resources

当我在用Java 8编写的程序中使用try资源时,文档,是否仍然需要或明确地关闭文件?

java

2
推荐指数
1
解决办法
108
查看次数

标签 统计

java ×2

apache-commons-cli ×1

boost ×1

c++ ×1

c++11 ×1

java-8 ×1

logging ×1

numpy ×1

python ×1