Closed
Description
Currently, if there's an error compiling code, you see something like this:
cpp_function('int add(int x) {
x + 1
}')
#> Error in dyn.load(shared_lib, local = TRUE, now = TRUE) :
#> unable to load shared object '/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T//RtmpLTptnM/fileafcc25bcdd37/src/code_1.so':
#> dlopen(/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T//RtmpLTptnM/fileafcc25bcdd37/src/code_1.so, 6): image not found
But this message isn't helpful.
A useful message is printed with quiet=FALSE
. However, it isn't immediately obvious to the user that this option is necessary to get a useful error, and it also includes a lot of other information as well:
cpp_function('int add(int x) {
x + 1
}', quiet = FALSE)
#> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/winston/R/4.0/cpp11/include -I/usr/local/include -fPIC -Wall -g -O2 -g -O0 -Wall -c /private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/code_2.cpp -o /private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/code_2.o
#> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/winston/R/4.0/cpp11/include -I/usr/local/include -fPIC -Wall -g -O2 -g -O0 -Wall -c /private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/cpp11.cpp -o /private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/cpp11.o
#> /private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/code_2.cpp:6:8: error: expected ';' after expression
#> x + 1
#> ^
#> ;
#> /private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/code_2.cpp:6:5: warning: expression result unused [-Wunused-value]
#> x + 1
#> ~ ^ ~
#> 1 warning and 1 error generated.
#> make: *** [/private/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T/RtmpLTptnM/fileafcc33aca4da/src/code_2.o] Error 1
#> make: *** Waiting for unfinished jobs....
#> Error in dyn.load(shared_lib, local = TRUE, now = TRUE) :
#> unable to load shared object '/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T//RtmpLTptnM/fileafcc33aca4da/src/code_2.so':
#> dlopen(/var/folders/vd/0_g4hj6d7kq_fw5gd_r0ml5w0000gn/T//RtmpLTptnM/fileafcc33aca4da/src/code_2.so, 6): image not found
It would be nice if the default behavior was to just print out errors.
Metadata
Metadata
Assignees
Labels
No labels