Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp_source() fails if there are hyphens in the filename #248

Open
paleolimbot opened this issue Nov 10, 2021 · 0 comments · May be fixed by #253
Open

cpp_source() fails if there are hyphens in the filename #248

paleolimbot opened this issue Nov 10, 2021 · 0 comments · May be fixed by #253

Comments

@paleolimbot
Copy link
Contributor

I imagine this isn't the intended behaviour but also has a very easy workaround (don't use hyphens in a C++ source filename).

temp <- tempfile(fileext = "contains-hyphen.cpp")
write("
#include <cpp11.hpp>

[[cpp11::register]]
void some_function() {}      
", temp)

cpp11::cpp_source(temp)
#> /private/var/folders/gt/l87wjg8s7312zs9s7c1fgs900000gn/T/Rtmp9b1IjL/file1045918f3e435/src/cpp11.cpp:5:43: error: expected ';' after top level declarator
#> extern "C" SEXP _file1045977566e56contains-hyphen_some_function() {
#>                                           ^
#>                                           ;
#> 1 error generated.
#> make: *** [/private/var/folders/gt/l87wjg8s7312zs9s7c1fgs900000gn/T/Rtmp9b1IjL/file1045918f3e435/src/cpp11.o] Error 1
#> make: *** Waiting for unfinished jobs....
#> Error: Compilation failed.
some_function()
#> Error in some_function(): could not find function "some_function"

Created on 2021-11-10 by the reprex package (v2.0.1)

@romainfrancois romainfrancois self-assigned this Dec 2, 2021
romainfrancois added a commit to romainfrancois/cpp11 that referenced this issue Dec 2, 2021
@romainfrancois romainfrancois linked a pull request Dec 2, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants