0

I spent most of the day setting up eclipse with statet plugin to build Rcpp packages. Many mistakes, and retries. I think I've nearly got it now.

The problem is that in a package that I wrote some time ago (using stone knives and clubs for development) I have used std::unique_ptr which is not being resolved by the code checker in eclipse. I have the following include directories already provided in the configuration:

C:/Rtools/mingw_64/lib/gcc/x86_64-w64-mingw32/4.9.3/include

C:/Rtools/mingw_64/lib/gcc/x86_64-w64-mingw32/4.9.3/include-fixed

C:/Rtools/mingw_64/x86_64-w64-mingw32/include

C:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++

C:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/backward

C:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32

I can see stdlib.h in C:/Rtools/mingw_64/x86_64-w64-mingw32/include So, I thought all would be good.

  • 1
    :-/ That's between you and MinGW. Can't help I am afraid. On my computer I have it in `/usr/include/c++/{7,8,8,10}/bits/unique_ptrr.h` coming from the different versions of `libstdc++-$X-dev` I have where `X` is again from `{7,7,9,10}`. – Dirk Eddelbuettel Aug 22 '20 at 23:50
  • Love ya Dirk, this is David Silkworth. Will probably give up on this IDE – Jacob Ormerod Aug 23 '20 at 02:15
  • 1
    We'll you'd have the same problem with any other frontend _on Windows_. I just don't know where the different mingw/msys/Rtoos/... packages keep that. More important is that they _do_ ship it or else many Rcpp project would blow up. – Dirk Eddelbuettel Aug 23 '20 at 02:19
  • Ok. Dirk solved the location problem. It was found at C:/Rtools/mingw_64/x86_64-mingw32/include/c++/bits – Jacob Ormerod Aug 23 '20 at 15:10
  • Ok. Dirk solved the location problem. It was found at C:/Rtools/mingw_64/x86_64-mingw32/include/c++/bits But even with this include configuration code checker still could not resolve the unique_ptr types throughout code. Then, when I ran the R CMD INSTALL (anyway, why not) the build failed due to a problem it decided was in an unused header wchar.h The problem was reported on 16 where #pragma pack(push,_CRT_PACKING) caused an error. I found this to be an old bug per https://sourceforge.net/p/mingw-w64/bugs/500/ I'm done with this! – Jacob Ormerod Aug 23 '20 at 15:16
  • Are you using the old (deprecated) Rtools or the newer Rtools4 with `gcc-8` and `g++-8`? The newer one may work better... – Dirk Eddelbuettel Aug 23 '20 at 15:22

1 Answers1

0

The header for std::unique_ptr is provided in <bits/unique_ptr.h> referenced from the C++ includes folder, which may vary from installation to installation. However, the standard library reference to std::unique_ptr indicates use of #include memory (inside<> brackets) . Sure enough there is a file named memory (with no extension) in the C++ includes folder, this in-turn includes the <bits/unique_ptr.h> as long as #if __cplusplus >= 201103L condition is satisfied.

So the include configuration C:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++ should have sufficed. However std::unique_ptr would not have been recognized by the eclipse code checker if somewhere else use of C++11 was not specified. This related question was answered in the following post:

How to enable C++11/C++0x support in Eclipse CDT?