[LLVMbugs] [Bug 10301] New: Link errors: C++ new operators with MSVC C++ Linker

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 7 10:37:46 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10301

           Summary: Link errors: C++ new operators with MSVC C++ Linker
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: art.oriented at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Windows, LLVM and clang

For the following simple C++ code:

//////////////////////////////
class DUMMY
{
public:
  DUMMY() { val1 = 0, val2 = 0.f; }
  int   val1;
  float val2;
};

int main()
{
  int* a = new int[10];
  DUMMY* b = new DUMMY();
  return a[0] + b->val1;
}
//////////////////////////////

clang and linking with MSVC C++ linker gives link errors:

new.o : error LNK2019: unresolved external symbol __Znaj referenced in function
_main
new.o : error LNK2019: unresolved external symbol __Znwj referenced in function
_main
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
new.exe : fatal error LNK1120: 3 unresolved externals

After simple searching, this is due to clang or LLVM didn't correctly emit some
C++ operator functions.

Of course, linking with g++ (MinGW) is okay.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list