Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:21:24+00:00 2026-06-07T21:21:24+00:00

#include rtest.h #include <iostream> SEXP rcpp_hello_world () { using namespace Rcpp ; CharacterVector x

  • 0
#include "rtest.h"
#include <iostream>

SEXP rcpp_hello_world ()
{
    using namespace Rcpp ;
    CharacterVector x = CharacterVector::create( "foo", "bar" );
    NumericVector y   = NumericVector::create( 0.0, 1.0 );
    List z                   = List::create (x, y);

    return z;
}

void funcA ()
{
    std :: cout << "\nsdfsdfsdf\n";
}

int main () {return 0;}

How to place
library(RgoogleMaps)
and
png (filename="Rg.png", width=480, height=480)
inside the above code?

I run it as: R CMD SHLIB rtest.cpp

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> 

Rcpp‘s version is 0.9.13

I tried:
R CMD SHLIB -lRgoogleMaps rtest.cpp

It resulted in:

anisha@linux-y3pi:~/> R CMD SHLIB -lRgoogleMaps rtest.cpp

g++ -I/usr/lib64/R/include -DNDEBUG  -I/usr/local/include   -I/usr/lib64/R/library/Rcpp/include -fpic  -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables  -c rtest.cpp -o rtest.o
g++ -shared -L/usr/local/lib64 -o rtest.so rtest.o -lRgoogleMaps -L/usr/lib64/R/lib -lR
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: cannot find -lRgoogleMaps
collect2: ld returned 1 exit status
make: *** [rtest.so] Error 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:21:27+00:00Added an answer on June 7, 2026 at 9:21 pm

    Why would you want to do this? Rcpp is designed for interfacing C++ code within an R session so that you can exploit faster computation or re-use existing C++ libraries.

    Write an R wrapper that calls the Rcpp code, have that wrapper arrange for the package to be made available (using require(RgoogleMaps)).

    Second, you don’t want to hard code the plotting device. Again, you could do this in R:

    png(filename="Rg.png", width=480, height=480)
    ##
    ## call Rcpp function
    ## in here
    dev.off()
    

    Rcpp isn’t meant for writing standalone C++ applications, you still want to interact with it from an R session.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <list> using std::list; class foo { ... class bar : public foo {
#include <iostream> using namespace std; int main() { int a, b, c, max; cout<<a=;
#include <iostream> #include <cassert> #include <vector> #include <ctime> #include <cstdlib> #include <Windows.h> using namespace
#include <iostream> #include <string.h> using namespace std; int main() { int e=0; int b=0;
#include <iostream> #include <string> using namespace std; string crash() { } int noCrash() {
#include <iostream> #include <fstream> using namespace std; int main() { ifstream stream1(source.txt); string line
#include stdafx.h #include <stdio.h> #include <iostream> #include <time.h> using namespace std; using namespace System;
#include <iostream> using namespace std; class test{ public: test() { cout<<CTOR<<endl; } ~test() {
#include<iostream> #include<string> using namespace std; int main(void) { struct STRCT { int num; string
I'd like to create the cross product of a list of types using variadic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.