title: Creating .dll files and compiling C++ code using Rcpp on Windows
body: <p>I am having a really hard time trying to make Rcpp work on my Windows. I downloaded Rtools and I have changed the path to </p>
  
  <blockquote>
    <p>c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\Program Files\R\R-3.0.2\bin\x64;[others]</p>
  </blockquote>
  
  <p>I have then taken a really simple c++ file (new.cpp) that goes like this</p>
  
  <pre><code>include &lt;Rcpp.h&gt;
  using namespace Rcpp;
  
  // [[Rcpp::export]]
  int timesTwo(int x) {
  return x * 2;
  }
  </code></pre>
  
  <p>I then go on the Powershell and as suggested on Seamless R and C++
  Integration with Rcpp by D. Eddelbuettel (Chap. 2) I try to compile the code</p>
  
  <pre><code>PS C:\Users\RXD308\pgmcpp&gt; PKG_CXXFLAGS='Rscript -e 'Rcpp:::CxxFlags()''\ PKG_LIBS='Rscript -e 'Rcpp:::LdFlags()''\ RCMD SHLIB new.cpp
  </code></pre>
  
  <p>Obtaining the error</p>
  
  <pre><code>An expression was expected after '('.
  At line:1 char:43
  + PKG_CXXFLAGS='Rscript -e 'Rcpp:::CxxFlags( &lt;&lt;&lt;&lt; )''\ PKG_LIBS='Rscript -e 'Rcpp:::LdFlags()''\ RCMD SHLIB new.cpp
  + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
  + FullyQualifiedErrorId : ExpectedExpression
  </code></pre>
  
  <p>Two last things</p>
  
  <ul>
  <li><p>I have MinGW up and working on my computer (g++ 4.6)</p></li>
  <li><p>I think I have a major problem with the R command in the powershell. In facts, as I access the powershell and I type "R --version" I obtain this error</p>
  
  <pre><code>Invoke-History : Cannot locate history for commandline --version.
  At line:1 char:2
  + R &lt;&lt;&lt;&lt;  --version
  + CategoryInfo          : ObjectNotFound: (--version:String) [Invoke-History],     ArgumentException
  + FullyQualifiedErrorId : InvokeHistoryNoHistoryForCommandline,Microsoft.PowerShell.Commands.InvokeHistoryCommand
  </code></pre></li>
  </ul>