Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document() packages with c++ code #193

Closed
baptiste opened this issue Nov 17, 2012 · 6 comments
Closed

document() packages with c++ code #193

baptiste opened this issue Nov 17, 2012 · 6 comments
Milestone

Comments

@baptiste
Copy link

I'm getting lots of errors when using document() on my package which contains a src directory with cpp code.:

document("~/Documents/github/cda")
Updating cda documentation
Loading cda
/Library/Frameworks/R.framework/Resources/bin/R --vanilla CMD SHLIB -o  \
  cda.so array.cpp cd.cpp cda.cpp internals.cpp linear.cpp utils.cpp  \
  zgels.f 

g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -I/usr/local/include    -fPIC  -g -O2  -c array.cpp -o array.o
In file included from array.cpp:1:
array.h:4:27: error: RcppArmadillo.h: No such file or directory
In file included from array.cpp:1:
array.h:6: error: 'arma' has not been declared
array.h:6: error: expected constructor, destructor, or type conversion before 'array_factor'
array.cpp:6: error: 'Rcpp' is not a namespace-name
array.cpp:6: error: expected namespace-name before ';' token
array.cpp:7: error: 'RcppArmadillo' is not a namespace-name
array.cpp:7: error: expected namespace-name before ';' token
array.cpp:9: error: 'arma' is not a namespace-name
array.cpp:9: error: expected namespace-name before ';' token
array.cpp:11: error: 'cx_colvec' does not name a type
array.cpp:44: error: expected constructor, destructor, or type conversion before '(' token
make: *** [array.o] Error 1
Error: Command failed (1)

Why is this function trying to compile the code? I'd expected it to be a simple wrapper for roxygen2::roxygenise, which runs without problem.

@hadley
Copy link
Member

hadley commented Nov 19, 2012

document runs load_all, which is needed because roxygen works dynamically, not statically, so needs to be able to load and execute all your code. I suspect #188 will probably remedy most of your problems.

@baptiste
Copy link
Author

running c++ code seems a bit of an overkill for standard roxygen use (I must be missing out cool things); could it be an option for document() to simply use roxygenise?
Even then, my c++ code compiles fine outside load_all(), but that's another issue I guess.

@hadley
Copy link
Member

hadley commented Dec 14, 2012

Can you try with the dev version? We recently checked a set of changes from JJ to improve C++ handling.

@hadley
Copy link
Member

hadley commented Jan 8, 2013

Works for me in a package with C++ code.

@hadley hadley closed this as completed Jan 8, 2013
@baptiste
Copy link
Author

baptiste commented Jan 9, 2013

I still get an error with https://github.com/baptiste/cda/blob/master/R/zzz.r

Updating cda documentation
Loading cda
Error in loadRcppModules(direct = FALSE) : 
  loadRcppModules can only be used within a .onLoad function

@hadley
Copy link
Member

hadley commented Jan 10, 2013

Oooh, you're using modules. Could you please file a new bug (referencing load_all as the root of the problem)?

@lock lock bot locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants