I am trying to execute c++ function using boost library in R. I've also installed boost header file package (BH). When I try to execute the code it give me the following error:
src <- '
#include <Rcpp.h>
#include <boost/math/special_functions/binomial.hpp>
for (unsigned long i = 0; i < 5; ++i) {
boost::math::binomial_coefficient<double>(25, i);
}'
sillyExp <- cfunction(signature(), src, convention = ".C")
Where I am going wrong?
Edit: Following is the error
Error in compileCode(f, code, language, verbose) :
Compilation ERROR, function(s)/method(s) not created! file68b0697546bd.cpp:11:54: fatal error: boost/math/special_functions/binomial.hpp: No such file or directory
#include <boost/math/special_functions/binomial.hpp>
^
compilation terminated.
make: *** [C:/PROGRA~1/R/R-34~1.3/etc/x64/Makeconf:215: file68b0697546bd.o] Error 1
Warning message:
running command 'make -f "C:/PROGRA~1/R/R-34~1.3/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-34~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file68b0697546bd.dll" WIN=64 TCLBIN=64 OBJECTS="file68b0697546bd.o"' had status 2
If you really want to execute some C++ code, then you can use Rcpp::evalCpp:
Rcpp::evalCpp("boost::math::binomial_coefficient<double>(25, 3)",
depends="BH",
include="#include <boost/math/special_functions/binomial.hpp>")
#> [1] 2300
Related
I'm trying to use google test to test a C function. A simple test using ASSERT_NO_FATAL_FAILURE(); and also EXPECT_THAT();. But when I try to use matchers (like not null for example) the IDE says: Use of undeclared identifier 'NotNull'.
#include "gtest/gtest.h"
extern "C" {
#include "first_tdd.h"
}
TEST(sum, sum_has_return)
{
EXPECT_THAT(sum(), NotNull());
}
cmake_minimum_required(VERSION 3.19)
project(untitled C)
set(CMAKE_C_STANDARD 99)
add_executable(main.c sum.c)
# 'Google_test' is the subproject name
project(Google_tests)
# 'lib' is the folder with Google Test sources
add_subdirectory(googletest)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}, ${gmock_SOURCE_DIR}/include ${gmock_SOURCE_DIR})
# 'Google_Tests_run' is the target name
# 'test1.cpp tests2.cpp' are source files with tests
set(Sources
sum.c
)
add_executable(Google_Tests_run sum_tests.cpp sum.c)
target_link_libraries(Google_Tests_run gtest gtest_main)
Message when I try to run the test.
error: use of undeclared identifier 'NotNull'
EXPECT_THAT(sum(), NotNull());
^
1 error generated.
make[3]: *** [CMakeFiles/Google_Tests_run.dir/sum_tests.cpp.o] Error 1
make[2]: *** [CMakeFiles/Google_Tests_run.dir/all] Error 2
make[1]: *** [CMakeFiles/Google_Tests_run.dir/rule] Error 2
make: *** [Google_Tests_run] Error 2
Folder Structure
Does any one know if I should include something else?
Thank you.
NotNull is declared in the namespace ::testing. Possible fixes
TEST(sum, sum_has_return)
{
EXPECT_THAT(sum(), ::testing::NotNull());
}
or
TEST(sum, sum_has_return)
{
using ::testing::NotNull;
EXPECT_THAT(sum(), NotNull());
}
I am using go-QT binding(https://github.com/therecipe/qt). My code is compiling & working good for amd64 but when I try to cross compile it for arm devices (Raspberrypi), it gives below error. Please advise how to solve this issue
**src/github.com/therecipe/qt/core/core.cpp:9:30: fatal error:
QAbstractAnimation: No such file or directory
compilation terminated.**
Environment Variables
GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/minhaj/GoLang"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
GOARM=""
CC="arm-linux-gnueabi-gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-
map=/tmp/go-build728594690=/tmp/go-build -gno-record-gcc-switches"
CXX="arm-linux-gnueabi-g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
Compilation Result
go build -v IndoorMass/
crypto
encoding
encoding/base64
crypto/sha256
unicode/utf16
flag
encoding/json
golang.org/x/image/math/fixed
github.com/golang/freetype/raster
golang.org/x/image/font
github.com/icza/mjpeg
github.com/golang/freetype/truetype
github.com/skip2/go-qrcode/bitset
github.com/skip2/go-qrcode/reedsolomon
path/filepath
io/ioutil
github.com/skip2/go-qrcode
container/list
golang.org/x/net/context
github.com/mattn/go-sqlite3
IndoorMass/General
github.com/tidwall/match
github.com/tidwall/gjson
compress/gzip
crypto/subtle
crypto/cipher
crypto/aes
internal/syscall/unix
math/rand
math/big
crypto/rand
crypto/des
crypto/elliptic
crypto/sha512
encoding/asn1
crypto/ecdsa
crypto/hmac
crypto/internal/cipherhw
crypto/md5
crypto/rc4
crypto/rsa
crypto/sha1
crypto/dsa
crypto/x509/pkix
encoding/hex
encoding/pem
internal/nettrace
internal/singleflight
net
crypto/x509
vendor/golang_org/x/crypto/chacha20poly1305/internal/chacha20
vendor/golang_org/x/crypto/poly1305
vendor/golang_org/x/crypto/chacha20poly1305
vendor/golang_org/x/crypto/curve25519
crypto/tls
vendor/golang_org/x/net/http2/hpack
vendor/golang_org/x/net/idna
vendor/golang_org/x/net/lex/httplex
vendor/golang_org/x/text/transform
vendor/golang_org/x/text/unicode/norm
vendor/golang_org/x/text/width
mime
mime/quotedprintable
net/textproto
mime/multipart
net/http/httptrace
net/http/internal
path
net/http
IndoorMass/Server
github.com/kaey/framebuffer
os/exec
github.com/mrmorphic/hwio
github.com/DexterInd/GrovePi/Software/Go/grovepi
IndoorMass/Sensor
github.com/therecipe/qt
github.com/therecipe/qt/core
# github.com/therecipe/qt/core
src/github.com/therecipe/qt/core/core.cpp:9:30: fatal error:
QAbstractAnimation: No such file or directory
compilation terminated.
IndoorMass/DB
IndoorMass/Manager
I am trying to configure Magento test automation framework on my system.
When I run phpunit in command line, I am getting following error. Same error I am getting while running test in the netbeans.
Strict Standards: Declaration of Mage_Selenium_Driver::doCommand() should
be compatible with that of PHPUnit_Extensions_SeleniumTestCase_Driver::doCommand()
in C:\MTAF\taf\lib\Mage\Selenium\Driver.php on line 38
..
Fatal error: Call to undefined method PHPUnit_Framework_TestSuite::isPublicTestMethod() in C:\MTAF\taf\lib\Mage\Selenium\TestCase.php on line 2502
Can some one please suggest some solution for the same.
I changed the code, this is the change I performed:
--- a/framework/Mage/Selenium/TestCase.php
+++ b/framework/Mage/Selenium/TestCase.php
## -409,7 +409,7 ## class Mage_Selenium_TestCase extends PHPUnit_Extensions_SeleniumTestCase
$testMethods = array();
$class = new ReflectionClass(self::$_testClass);
foreach ($class->getMethods() as $method) {
- if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
+ if ($method->isPublic()) {
$testMethods[] = $method->getName();
}
}
I was getting this error when running phpunit >= 4.0. Downgrading to 3.7.x solved it for me.
How do I show a popup in Blackberry 10? I want to show popup when any contact is added /deleted/updated. I took one method like this---
void ContactEditor::showToast(QString text) {
bb::system::SystemToast toast;
toast.setBody(text);
toast.setPosition(bb::system::SystemUiPosition::MiddleCenter);
toast.exec();
}
and called like this---
showToast("contact added...");
included file for System Toast also.
but this is giving me error----
make[2]: *** [o-g/addressbook] Error 1
make[1]: *** [debug] Error 2
make: *** [Simulator-Debug] Error 2
can somebody tell me whats the problem ?
Add LIBS += -lbbsystem to your application pro file. and include
#include <bb/system/SystemToast>
SystemToast *toast = new SystemToast(this);
toast->setBody("Your Toast");
toast->setPosition(SystemUiPosition::MiddleCenter);
toast->show();
I want to compile following file:
https://gist.github.com/bodokaiser/5382281
which does not succeed because I get following error:
CXX(target) Release/obj.target/parser/src/parser/parser.o
In file included from ../src/parser/parser.cc:2:
../src/parser/calc_head_size.cc:67:16: error: expected expression
if (mask || isMasking(masking)) {
^
1 error generated.
make: *** [Release/obj.target/parser/src/parser/parser.o] Error 1
This does not make sense to me. Can it be that there is something else wrong?
Bodo
You seem to have a strange character in your source code that looks like a space but isn't. In this line:
if (mask || isMasking(masking)) {
// ^ here
try to delete the "space" and add a real space.