[LLVMbugs] [Bug 20868] New: clang does not pass link libraries correcly to MSVC's link.exe

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 6 08:07:05 PDT 2014


            Bug ID: 20868
           Summary: clang does not pass link libraries correcly to MSVC's
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: felixhaedicke at web.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13002
  --> http://llvm.org/bugs/attachment.cgi?id=13002&action=edit
Hello world example to reproduces

I am using clang to compile windows programs using the MSVC libraries and
tools, and the traditional gcc style driver (not clang-cl).

The attached example code needs an external library ("oldnames.lib") to link.
So normally, I would call it like this (the syntax works fine when comping with
MingW instead of MSVC):

clang -target i686-pc-windows-msvc main.c -o main.exe -loldnames

Unfortunately, this produces the following error (sorry, the error is in
LINK : warning LNK4044: Nicht erkannte Option /loldnames; wird ignoriert.
LINK : fatal error LNK1181: Eingabedatei "oldnames.obj" kann nicht geƶffnet
clang.exe: error: linker command failed with exit code 1181 (use -v to see

It seems that "-loldnames" is passed directly to the MSVC linker. This happens
with every library, not just "oldnames".

As a workaround, the following call works:
clang -target i686-pc-windows-msvc main.c -o main.exe -Wl,oldnames.lib

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/20140906/e7dfe582/attachment.html>

More information about the llvm-bugs mailing list