Skip to content

Fails when file name is cpp11.cpp #133

Closed
@dfalbel

Description

@dfalbel

cpp_source fails when the source file is called cpp11.cpp:
It will also fail if the file name contains . or -, but the error messages here are more informative.

writeLines('
[[cpp11::register]]
int add(int x, int y, int z) {
  int sum = x + y + z;
  return sum;
}', "cpp11.cpp")

cpp11::cpp_source("cpp11.cpp")
#> Error in (function (command = NULL, args = character(), error_on_status = TRUE, : System command 'R' failed, exit status: 1, stderr:
#> E> duplicate symbol '__cpp11_add' in:
#> E>     /private/var/folders/x0/fqbv9_ys1lq55xqjqbqllzqm0000gn/T/RtmpbkL1uf/file215a3ddf389a/src/cpp11.o
#> E> ld: 1 duplicate symbol for architecture x86_64
#> E> clang: error: linker command failed with exit code 1 (use -v to see invocation)
#> E> make: *** [/private/var/folders/x0/fqbv9_ys1lq55xqjqbqllzqm0000gn/T/RtmpbkL1uf/file215a3ddf389a/src/cpp11.so] Error 1

Created on 2020-11-27 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions