clang++ -Xlinker -v reports error: linker command failed with exit code 1
Dec 26, 2018 at 1:46am UTC
When running
clang++ -Xlinker -v
, to look to the search path for libraries I get:
@(#)PROGRAM:ld PROJECT:ld64-409.12
BUILD 17:47:51 Sep 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32
Library search paths:
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Why do I get
Undefined symbols for architecture x86_64
and
clang: error: linker command failed with exit code 1 (use -v to see invocation)
?
Last edited on Dec 26, 2018 at 6:29pm UTC
Dec 26, 2018 at 2:13am UTC
It seems you have not defined main.
If you don't want to link now, but link later, you can compile with -c
.
You probably should be using something like XCode so the IDE can automatically do this for you.
Dec 26, 2018 at 1:19pm UTC
Thank you for your reply. I understand command clang++ -Xlinker -v
just gives directories where the compiler searches for the header files and libraries. I am not compiling any code.
Dec 26, 2018 at 9:45pm UTC
Sorry I misunderstood you.
This is what you are looking for clang++ -print-search-dirs
Note that -Xlinker just forwards the options to ld.exe.
On my machine -Xlinker -v
doesn't tell me what the search paths are (msys2-clang).
Topic archived. No new replies allowed.