[cfe-dev] [libc++] link errors on Windows

Hamza Sood via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 28 12:16:44 PDT 2017


I’ve built libc++ on Windows as shown in the documentation, but I’m having trouble linking a simple program.

#include <string>
int main() {
  std::string s = “Hello world”;
  const char *data = s.data();
}

LLD fails to link with the following error: undefined symbol: __imp_?data@?$basic_string at DU?$char_traits at D@__1 at std@@V?$allocator at D@23@@__1 at std@@QEAAPEADXZ.
MSVC link.exe errors in the same way.

Interestingly it works fine if s.data() is changed to s.c_str().

Am I doing something wrong or is this a bug?
It looks like the string header marks basic_string::data as having inline visibility, so I’m not sure why this doesn’t work.


More information about the cfe-dev mailing list