1

I have installed clang on my Windows 10 machine.

$ clang --version
clang version 6.0.1 (tags/RELEASE_601/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

With it, I can compile C and C++ sources and generate object files, and use lib.exe to create libraries of them.

When it's time to link it into a binary, to my surprise, clang is creating a lib/exp output, not an executable?

Why does clang think it should be creating a library, not an executable?

clang++  -oarmor XWin/main.o -lSDL2main -lpi -ldblunt -lsino -lbase -L. -L ../../src/sino -L MSWin/libs/SDL/lib ../../src/Chipmunk2D/build.release/x64/Release/chipmunk.lib MSWin/libs/OpenAL/lib/OpenAL32.lib -lSDL2 -lOpenGL32
   Creating library armor.lib and object armor.exp
LINK : fatal error LNK1561: entry point must be defined
clang++.exe: error: linker command failed with exit code 1561 (use -v to see invocation)

In UNIX, clang will by default create binaries, not libraries?

Bram
  • 7,440
  • 3
  • 52
  • 94

1 Answers1

-2

Check this link - https://metricpanda.com/rival-fortress-update-27-compiling-with-clang-on-windows

There are currently two flavors of Clang that work on Windows: vanilla LLVM Clang and Clang/C2 with Microsoft Codegen.

deepak joshi
  • 125
  • 1
  • 9
  • 2
    Please, don't just drop a link with next to no useful information. Stack Overflow is intended to remain helpful in case off-site resources become unreachable. – IInspectable Sep 29 '18 at 19:21