8 Replies - 352 Views - Last Post: 28 October 2017 - 12:42 AM

#1 Thunderer  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 94
  • Joined: 25-June 17

Me trying for a year can't run Clang

Posted 27 October 2017 - 12:20 AM

I am using Code::Blocks IDE and trying to use Clang. I installed (now) the latest version of Clang and installed it. Compiling is always successful but I could never convert the object file to exe. I shows that can't find main printf and all. I think complier can't find the libraries (problem with the linker :( ). Even I tried with command line still no good;.

Is This A Good Question/Topic? 0
  • +

Replies To: Me trying for a year can't run Clang

#2 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6374
  • View blog
  • Posts: 25,756
  • Joined: 12-December 12

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 01:01 AM

Describe the steps you have taken.

If there is an error then provide the exact error details.
Was This Post Helpful? 0
  • +
  • -

#3 Thunderer  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 94
  • Joined: 25-June 17

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 01:23 AM

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\user>cd /d C:\\Users\user\Desktop

C:\Users\user\Desktop>clang t_102.c -c
t_102.c:226:12: warning: non-portable path to file '<STDIO.H>'; specified path differs in case from file name on disk
      [-Wnonportable-include-path]
  #include <stdio.h> //Called printf() and getchar(); defined NULL
           ^~~~~~~~~
           <STDIO.H>
t_102.c:227:11: warning: non-portable path to file '<STDLIB.H>'; specified path differs in case from file name on disk
      [-Wnonportable-include-path]
        #include <stdlib.h> //Called rand()
                 ^~~~~~~~~~
                 <STDLIB.H>
t_102.c:228:11: warning: non-portable path to file '<TIME.H>'; specified path differs in case from file name on disk
      [-Wnonportable-include-path]
        #include <time.h> //Called time()
                 ^~~~~~~~
                 <TIME.H>
3 warnings generated.

C:\Users\user\Desktop>clang -Wall -std=c99 t_102.o
clang.exe: error: linker command failed due to signal (use -v to see invocation)

C:\Users\user\Desktop>clang -Wall -std=c99 t_102.o -v
clang version 6.0.0 (trunk)
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\LLVM\bin
 "E:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\link.exe" -out:a.exe -defaultlib:libcmt -nologo t_102.o
clang.exe: error: linker command failed due to signal (use -v to see invocation)

C:\Users\user\Desktop>
:(
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6374
  • View blog
  • Posts: 25,756
  • Joined: 12-December 12

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 01:33 AM

A search of "clang.exe: error: linker command failed due to signal" is worthwhile. For example, link

Quote

Oh, you are trying to build native applications with clang on Windows? That's not well supported by clang. The problem you are getting is that clang is not able to find Visual Studio link.exe. If you want to still try, you need to have VS link.exe in PATH. One way to do that is to run clang.exe in Visual Studio Command Prompt, but note that clang supports Win32 ABI in a very poor manner.

But I know nothing about this myself... I'm just hinting at the kind of searching you could be performing while waiting for a further response.

(Or do you need to install a linker separately? link)
Was This Post Helpful? 2
  • +
  • -

#5 Thunderer  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 94
  • Joined: 25-June 17

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 01:34 AM

Thanks for the link man, who knows that help
Was This Post Helpful? 0
  • +
  • -

#6 Thunderer  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 94
  • Joined: 25-June 17

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 01:46 AM

t_102.o:(.text+0x142): undefined reference to `memcpy'
t_102.o:(.text+0x162): undefined reference to `memcpy'
t_102.o:(.text+0x608): undefined reference to `rand'
t_102.o:(.text+0x7fd): undefined reference to `rand'
t_102.o:(.text+0x85d): undefined reference to `printf'
t_102.o:(.text+0x8d6): undefined reference to `printf'
t_102.o:(.text+0x8f7): undefined reference to `getchar'
t_102.o:(.text+0xa20): undefined reference to `printf'
t_102.o:(.text+0xa4d): undefined reference to `printf'
t_102.o:(.text+0xa63): undefined reference to `printf'
t_102.o:(.text+0xb21): undefined reference to `srand'
t_102.o:(.text+0xb3f): undefined reference to `printf'
t_102.o:(.text+0xb50): undefined reference to `printf'
t_102.o:(.text+0xb61): undefined reference to `printf'
t_102.o:(.text+0xb72): undefined reference to `printf'
t_102.o:(.text+0xb7a): undefined reference to `getchar'
t_102.o:(.text+0xbac): undefined reference to `printf'
t_102.o:(.text+0xbe4): undefined reference to `_time64'

Both links :(
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13483
  • View blog
  • Posts: 53,820
  • Joined: 12-June 08

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 07:29 AM

Just a side comment - if you have been trying for over a year's worth of time to use Clang.. perhaps make the choice to try another IDE substantially earlier.
Was This Post Helpful? 0
  • +
  • -

#8 jimblumberg  Icon User is offline

  • member icon

Reputation: 5332
  • View blog
  • Posts: 16,601
  • Joined: 25-December 09

Re: Me trying for a year can't run Clang

Posted 27 October 2017 - 07:48 AM

Quote

InstalledDir: C:\Program Files (x86)\LLVM\bin
"E:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\link.exe" -out:a.exe -defaultlib:libcmt -nologo t_102.o


I think that the above message is probably the root of your problems. You need to investigate why Microsoft's linker is being called instead of the LLVM linker. Check your IDE's compiler settings and make sure you specify the proper directories for where each component of clang is installed.


Jim
Was This Post Helpful? 0
  • +
  • -

#9 Thunderer  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 94
  • Joined: 25-June 17

Re: Me trying for a year can't run Clang

Posted 28 October 2017 - 12:42 AM

Tried couple of IDEs, changed options, ran from visual studio's shell, etc. No good in anything may be I should stick with GCC, clang isn't for me :(
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1