2

I sucessfully ran the sample codes in the package. Then I copied code from sample1 into another file of mine and set it up to compile using Makefile. Also copied sample copies into the same directory. The samples in the directory compile and run fine. But using R in my already existing code is giving issues. When compiling it gives an error saying expected unqualified-id before âreturnâ. This happens in the line where I declare RInside R(argc, argv).

Another weird thing i noticed is if i include at the bottom of included files, I get a bunch of errors in Rcpp etc. but if i include it at the top, all those errors disappear.

Also, is the default compile option of -O3 required for the package? I have been using -Ofast for most of my codes. Browsing through the questions here I think I need to make changes to CXXFLAGS in Makevars but i can't find out where. Any help appreciated.

I have boiled down the errors to another file included in my setup which is "k.h". This is a file which is used to interface c++ with kdb+ database. If I include the file before I get errors in Rcpp classes. When included after RInside, I get the earlier error of unqualified id before return.

This is the file in question: k.h

Resolved: It appears it was a variable name conflict. In all examples we have RInside R(argc, argv). As soon as I changed it to RInside L(argc, argv) everything worked fine. Don't know exactly why this was the case but it solves the problem at least. Tested outputs too.

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
Naveen Sharma
  • 1,057
  • 12
  • 32

0 Answers0