Skip to content

cpp version won't work on windows #56

@shrektan

Description

@shrektan

Hi, thanks for the useful package and it works fine on my mac for both the R version and Cpp version. However, the cpp version of progress bar fails to display on windows. Here's a minimal repro (using the code from your test package):

library(Rcpp)

sourceCpp(code = '
#include <Rcpp.h>
#include <RProgress.h>
#include <unistd.h>

// [[Rcpp::depends("progress")]]

// [[Rcpp::export]]
Rcpp::CharacterVector test_progress(Rcpp::CharacterVector formatSEXP =
"[:bar] :percent ") {
BEGIN_RCPP

const char *format = formatSEXP[0];
RProgress::RProgress pb(format);

pb.tick(0);
for (int i = 0; i < 100; i++) {
usleep(2.0 / 100 * 1000000);
pb.tick();
}

Rcpp::CharacterVector result(1);
result[0] = "DONE";
return result;

END_RCPP
}'
)

test_progress()

my session info

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936   
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C                                                   
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936    

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

other attached packages:
[1] Rcpp_0.12.13

loaded via a namespace (and not attached):
[1] compiler_3.4.1    magrittr_1.5      assertthat_0.2.0  R6_2.2.2          prettyunits_1.0.2 tools_3.4.1      
[7] yaml_2.1.14       progress_1.1.2 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions