[R] Rprintf will not build in my C++ compiler
nmarti
nate318i at yahoo.com
Wed Jul 30 23:06:24 CEST 2008
Who cares that "An Introduction to the .C Interface to R" is not an
"Official" manual.
Does it matter?
I was just trying to site where I got the code from and not claim it as my
own. Would you prefer if I plagiarized stuff Professor?
Sorry for not posting in devel, I thought this was a basic question.
Prof Brian Ripley wrote:
>
> That is a linker (not compiler) message, and you apparently forgot to link
> against R.dll. See README.packages in the R distribution for how to use
> VC++ with R under Windows (which is neither recommended nor supported).
>
> Three other comments.
>
> 1) See the posting guide. R-devel is the list for non-R programming
> questions.
>
> 2) See the posting guide. You didn't show how you compiled your code nor
> what exact command gave that error message.
>
> 3) See 'Writing R Extensions'. For that code to be any use with R, it has
> to have a C and not C++ entry point 'hello'.
>
> On Wed, 30 Jul 2008, nmarti wrote:
>
>>
>> I have searched through the threads and "Rprintf" causing a build error
>> dosen't seem to be a problem for anyone else. And I've read through "R
>> Extensions" and "An Introduction to the .C Interface to R" and there
>> doesn't
>> seem to be any troubleshooting for my problem.
>
> Well, you _are_ using an unsupported compiler/linker.
>
>> My code is straight from "An Introduction to the .C Interface to R" pg.
>> 3.
>
> Which is what? (Not an official manual.)
>
>> And my compiler is VC++ 2005 Express
>> ----------------------
>> #include <R.h>
>>
>> void hello( int *n ) {
>> int i ;
>> for( i = 0 ; i < *n ; i++ ) {
>> Rprintf( "Hello, world!\n" ) ;
>> }
>> }
>> ----------------------
>> When I try to build this code, I recieve 2 error massages,
>> "error LNK2019: unresolved external symbol _Rprintf referenced in
>> function
>> "void _cdecl hello(int *n)" (?hello@@YAXPAH at Z)"
>> "fatal error LNK1120: 1 unresolved externals"
>>
>> To be honest, I'm not exactly sure what these errors mean, I'm still
>> learning C++.
>> Any thoughts would be appreciated.
>> --
>> View this message in context:
>> http://www.nabble.com/Rprintf-will-not-build-in-my-C%2B%2B-compiler-tp18735205p18735205.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/Rprintf-will-not-build-in-my-C%2B%2B-compiler-tp18735205p18742866.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list