Rcpp error through RExcel - c++

I have a problem in using Rcpp from Rexcel.
(especially, sourceCpp() function)
I'm running a 64-bit Windows 10 platform.
I installed R ver 3.3.1 and RExcel.
I also installed Rtools by Rtools34.exe.
I can use RExcel properly if I don't use sourceCpp().
Hoewver, when I use sourceCpp() function, I have an error.
From Rexcel, I execute the command
library(Rcpp)
and this step, there is no error.
Next, I put the following command
sourceCpp("C:/Users/ChrisCCCCC/Desktop/ChrisCCCCC/program/samplecode.cpp")
and Run code.Then, the error message
Error in command:
sourceCpp("C:/Users/ChrisCCCCC/Desktop/ChrisCCCCC/program/samplecode.cpp")
'C:/Program' not found
attr(,class)
[1] try-error
Is anyone else know the reason of this error?
Of course I set the path for Rtools.
and I can run the code
sourceCpp("C:/Users/ChrisCCCCC/Desktop/ChrisCCCCC/program/samplecode.cpp")
with no error from normal RGui and RStudio.
Why sourceCpp() causes an error through RExcel while there is no error through normal RGui?
Can anyone help me, please?

Related

Unable to resolve configuration with compiler Path

I have been getting this error message after installing VS code (New computer just reinstalling things) and I ran into this error message after installing splashkit + the c++ extension:
Unable to resolve configuration with compilerPath: C:/Users/willi/Documents/Code/102/Test/g++.exe
I would imagine I need to change the path variable but I am not sure.
Thanks
EDIT: I get this error message after using the command:
skm clang++ program.cpp -o One
I'm sure I am missing something easy here, but I haven't ran into this one before.

Tensorflow C++ API guide examples on Windows

I built tensorflow with VS2015 and I was able to run some examples,
as tf_tutorials_example_trainer and label_image.
Then I tried to run the samples here. I was able to compile and start the example.cc but when reaching the line
Scope root = Scope::NewRootScope();
I get this error:
Op type not registered 'NoOp' in binary running on DESKTOP-S5QHRCE.
Make sure the Op and Kernel are registered in the binary running in this process
What am I missing?
I found this.Thanks to Joe, who explains how to use the /WHOLEARCHIVE option to fix the issue.To avoid out of memory error during linking if using Optimize for debugging (/DEBUG) option, do msbuild /p:Configuration=Release youproject.vcxproj in a command prompt.

Imunnity Debugger PyCommands: failed to locate main function

relatively simple question here. I recently installed immunity debugger for the PyCommands feature, however whenever I try to write my own pycommand and execute it in immunity, it gives me the error message "failed to locate main function". Odd, considering I did write a main(args) function. The code I tried to use was as follows:
#!usr/bin/env python
from immlib import *
def main(args):
imm = Debugger()
return "[*] Command successfully executed."
I cannot see what is wrong with this, as I have only been following the example scripts included with Immunity. I have also checked !list which shows my command on a list of available commands, but when I try to run it from there, it still throws the error. Does anyone know why this might be?
OS: Windows XP SP3 x86 (VMWare)
Python 2.7.3
So I just figured out my own problem. The name of the command was 'test'. I'm guessing test was a reserved word or something, because I renamed it to mycommand and got the desired output. If anyone else comes across this issue with immunity, I hope this helps.

Rcpp error, learning Rcpp and C++ on mac

I've decided to start learning Rcpp and C++ so I can make aspects of my R code faster. For a start I'm using the tutorial hadley has in the devtools wiki. I have a c++ compiler on this machine in that it's a mac and I have xcode installed on it - I'm told that puts the c++ compiler on the machine. I try to run the first example:
cppFunction('
int one(){
return 1;
}
')
However, what happens is:
sh: make: command not found
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
I'm guessing I have a setup issue, but what to do I'm not sure. For a general C++ knowlege I've started reading Absolute C++ by Savitch, which so far does not actually tell you anything about setting up a machine with compiler etc, because you're instructed to use something called MyProgrammingLab which just tells you if you got the answer right or not and gives output, you don't go through the compilation or anything like that.
Thanks,
Ben W.
Errors of the type sh: foo: command not found are pretty obvious. You are lacking the make command. Install it, and try again. Or if Xcode installs it outside of the path, add it to the path.

Error in compiling when installing Stan for R and when using Rcpp

I need to install Rstan for a data analysis class. The instructions are posted here http://code.google.com/p/stan/wiki/RStanGettingStarted. I'm running Mac OS 10.5.8 and R 2.15.1 GUI 1.52 Leopard build 32-bit (6188). I just installed Xcode version 3.1.4, the Xcode c++ compiler that is compatible with leopard (I had to get a mac developer account to do this).
Per the Stan installation instruction, I entered the following code to see if my compiler was working:
library(inline)
library(Rcpp)
src <- '
std::vector<std::string> s;
s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
'
hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
cat(hellofun(), '\n')
It returns the following error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
Library/Frameworks/R.framework/Versions/2.15/Resources/library/
Rcpp/include/Rcpp/internal/export.h: In function ‘void
Rcpp::internal::export_range__dispatch(SEXPREC*, InputIterator,
Rcpp::traits::r_type_primitive_tag)’:
/Library/Frameworks/R.framework/Versions/2.15/Resources/
library/Rcpp/include/Rcpp/internal/export.h:56: internal
compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for
instructions.
make: *** [file795214e66510.o] Error 1
In addition: Warning message:
running command '/Library/Frameworks/R.framework/Resources/bin/
R CMD SHLIB file795214e66510.cpp 2>
file795214e66510.cpp.err.txt' had status 1
When I try to install stan:
install.packages('rstan', type = 'source') ]
I get this warning:
Warning message:
In install.packages("rstan", type = "source") :
installation of package ‘rstan’ had non-zero exit status
I have no idea how C++ works. All of my coding experience is in R and has not before required compiling into C++. I've been trying really hard to figure out what's wrong for the last 4 hours or so, googling these error messages over and over without much luck. Any help would be greatly appreciated and would also help about 10 other students in my class who are having identical or analogous problems. Thank you very, very much.
This looks to me like an issue with the installation of your C++ compiler or with your installation of the Rcpp package, rather than an issue with the rstan package. However, if g++ is causing an intractable problem for you, an alternative is the clang compiler, which should work with Rcpp and rstan if you create $HOME/.R/Makevars with these two lines
CC=clang
CXX=clang++
As mentioned in another answer, the first step is to get Rcpp working on your Mac (i.e,. at least pass the hello world example).
A similar issue for Rcpp previously:
https://stat.ethz.ch/pipermail/r-sig-mac/2010-July/007574.html
In addition, from this webpage http://useyourloaf.com/blog/2011/03/21/compiler-options-in-xcode-gcc-or-llvm.html, it seems that gcc 4.2 and 4.0 are both in Xcode 3.14 (not sure as it does not say it's 3.14). So try to make sure gcc 4.2.1 is used by R is important. Executing the following in a terminal will show what is the current version of gcc.
$ g++ -v