首先,我对这些东西不是很熟练,所以我可能会写一些愚蠢的问题,请善待;-)
我有一个调用 C++ 代码的 R 代码。不幸的是,我的代码有问题,可能是内存未映射,我想使用 valgrind 来尝试了解错误在哪里。
几年前我已经使用它了,但现在它似乎不起作用。当我吃午饭时,以下命令
R -d valgrind
我得到这个输出
==69495== Memcheck, a memory error detector
==69495== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==69495== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==69495== Command: /Library/Frameworks/R.framework/Resources/bin/exec/R
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476E2C: df_bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476A15: df (in /usr/lib/system/libcorecrypto.dylib)
==69495== …Run Code Online (Sandbox Code Playgroud) 我正在学习 Julia,我对 Types 有点困惑。我的是一个非常基本的问题。我明白如果我写
x = 64.0::MyType
Run Code Online (Sandbox Code Playgroud)
x 应包含值 64,Type 等于 MyType。但是如果我写
x = 64.0::Float32
Run Code Online (Sandbox Code Playgroud)
我收到错误
ERROR: TypeError: in typeassert, expected Float32, got Float64
Run Code Online (Sandbox Code Playgroud)
我发现以下没有给我一个错误
x = convert(Float32,64.0)
Run Code Online (Sandbox Code Playgroud)
这是正确的方法吗?好像太纠结了。
我开始说我是编程的新手,然后我不确定我是否能够很好地解释我的问题.
我写了一些c ++代码,这些代码被一些R函数加载和使用.
要编译代码,我使用了以下代码:
R CMD SHLIB MyCode.cpp
Run Code Online (Sandbox Code Playgroud)
我用R加载了库
dyn.load("MyCOde.so")
Run Code Online (Sandbox Code Playgroud)
有时我也建立了一个R包,我可以将它加载到R.
如果我在带有山狮的Mac上做所有这些东西一切都很好,但现在我换了小牛,我有一些问题.该R CMD SHLIB MyCode.cpp命令有效,但当我使用时,dyn.load("MyCOde.so")我得到以下文字:
Errore in dyn.load(paste(dir_function, "MyCOde.so", sep = "")) :
unable to load shared object 'MyCOde.so':
dlopen(MyCOde.so, 6): Symbol not found: __ZNSt8ios_base4InitC1Ev
Referenced from: MyCOde.so
Expected in: flat namespace
in MyCOde.so
Run Code Online (Sandbox Code Playgroud)
此外,如果我尝试在R中加载包,我得到以下内容
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [MyCode.so] …Run Code Online (Sandbox Code Playgroud)