Unga
2015-Apr-26 07:50 UTC
[LLVMdev] How to compile a simple C program with clang on Windows 8.1?
Hi all I need a small help to get my first C program to compile on Widows 8.1. I'm an Unix guy but new to Windows. I installed MS Visual Studio 2013 free version and the LLVM 3.6.0 binary pre-built version. Here is my sample C program: #include <stdio.h> int main() { printf("hello world\n"); return 0; } 1.>clang test1.c -o test1.exetest1.c:2:10: fatal error: 'stdio.h' file not found #include <stdio.h> 2.>clang test1.c -I"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" -o test1.exe In file included from test1.c:2: In file included from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdio.h:20: In file included from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\crtdefs.h:74: c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vadefs.h:50:9: error: unknown type name '__w64' typedef _W64 unsigned int uintptr_t; My questions: a) Am I referring to the correct C header files folder? b) Do I have to include a Windows specific include file where __w64 is defined? Many thanks in advance. Best regardsUnga -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150426/a48e8f32/attachment.html>
Richard Pennington
2015-Apr-26 13:07 UTC
[LLVMdev] How to compile a simple C program with clang on Windows 8.1?
On 04/26/2015 02:50 AM, Unga wrote:> Hi all > > I need a small help to get my first C program to compile on Widows > 8.1. I'm an Unix guy but new to Windows.[snip] Hi Unga, I can't help you with Visual Studio since I've never used it, but I would like to suggest that you try out ELLCC. ELLCC is a tool chain based on clang/LLVM that can target Windows as well as several Linux based systems. The binary downloads have all the stuff you need to build: C/C++ compiler, linker, debugger, and pre-built libraries. Here's an example of "hello world" under Windows 8.1: http://ellcc.org/blog/?p=23650 Follow the links to the download page to get to the binary downloads. You can also get the full source and build it yourself if you're so inclined. -Rich
Kuperstein, Michael M
2015-Apr-26 14:50 UTC
[LLVMdev] How to compile a simple C program with clang on Windows 8.1?
Hi Unga, Try clang-cl instead of clang. It’s a version of the clang driver that should set the environment up correctly (in terms of defines, include paths, etc.). Michael From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Unga Sent: Sunday, April 26, 2015 10:51 To: llvmdev at cs.uiuc.edu Subject: [LLVMdev] How to compile a simple C program with clang on Windows 8.1? Hi all I need a small help to get my first C program to compile on Widows 8.1. I'm an Unix guy but new to Windows. I installed MS Visual Studio 2013 free version and the LLVM 3.6.0 binary pre-built version. Here is my sample C program: #include <stdio.h> int main() { printf("hello world\n"); return 0; } 1.>clang test1.c -o test1.exetest1.c:2:10: fatal error: 'stdio.h' file not found #include <stdio.h> 2.>clang test1.c -I"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" -o test1.exeIn file included from test1.c:2: In file included from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdio.h:20: In file included from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\crtdefs.h:74: c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vadefs.h:50:9: error: unknown type name '__w64' typedef _W64 unsigned int uintptr_t; My questions: a) Am I referring to the correct C header files folder? b) Do I have to include a Windows specific include file where __w64 is defined? Many thanks in advance. Best regards Unga --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150426/e307cab5/attachment.html>
Unga
2015-Apr-27 14:00 UTC
[LLVMdev] How to compile a simple C program with clang on Windows 8.1?
This problem was solved after I compile and install LLVM and Clang from source. Thanks for replies. Unga On Sunday, April 26, 2015 7:50 AM, "Kuperstein, Michael M" <michael.m.kuperstein at intel.com> wrote:> > >Hi Unga, > >Try clang-cl instead of clang. >It’s a version of the clang driver that should set the environment up correctly (in terms of defines, include paths, etc.). > >Michael > >From:llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Unga >Sent: Sunday, April 26, 2015 10:51 >To: llvmdev at cs.uiuc.edu >Subject: [LLVMdev] How to compile a simple C program with clang on Windows 8.1? > >Hi all > >I need a small help to get my first C program to compile on Widows 8.1. I'm an Unix guy but new to Windows. > >I installed MS Visual Studio 2013 free version and the LLVM 3.6.0 binary pre-built version. > >Here is my sample C program: > >#include <stdio.h> >int main() { > printf("hello world\n"); > return 0; >} > > >1. >>clang test1.c -o test1.exe >test1.c:2:10: fatal error: 'stdio.h' file not found >#include <stdio.h> > >2. >>clang test1.c -I"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" -o test1.exe >In file included from test1.c:2: >In file included from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdio.h:20: >In file included from c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\crtdefs.h:74: >c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vadefs.h:50:9: error: > unknown type name '__w64' >typedef _W64 unsigned int uintptr_t; > >My questions: > >a) Am I referring to the correct C header files folder? > >b) Do I have to include a Windows specific include file where __w64 is defined? > >Many thanks in advance. > >Best regards >Unga > > >--------------------------------------------------------------------- >Intel Israel (74) Limited >This e-mail and any attachments may contain confidential material for >the sole use of the intended recipient(s). Any review or distribution >by others is strictly prohibited. If you are not the intended >recipient, please contact the sender and delete all copies. > >