[llvm-bugs] [Bug 42516] New: "duplicate symbol" when using "-fprofile-instr-generate" and "using namespace std; " is used in two .cpp files

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 5 04:11:42 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42516

            Bug ID: 42516
           Summary: "duplicate symbol" when using
                    "-fprofile-instr-generate" and "using namespace std;"
                    is used in two .cpp files
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alorbach at adiscon.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

So I am trying to do coverage with -fprofile-instr-generate and
-fcoverage-mapping on Windows with clang-8 (confirmed that devel clang 9 has
the same problem).

So if have a library porject that have two .cpp files in your project which use
this on top: 

using namespace std;

Once the compiled library is linked, you will get this error: 

Error           duplicate symbol: __profn_??_G_Facet_base at std@@UEAAPEAXI at Z in
project.lib(code1.obj) and in project.lib(code2.obj)

I could nail the problem down the namespace std, if you remove it from one if
the code files it will link.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190705/bdd8469e/attachment.html>


More information about the llvm-bugs mailing list