[cfe-users] How do I USE this?

Madison Link via cfe-users cfe-users at lists.llvm.org
Wed Sep 6 14:43:22 PDT 2017


I’m trying to get a new compiler working because GCC is simply not 
working on my system. I’ve heard great things about LLVM / CLang, and 
would like to try it out, but I’m having trouble getting it to work at 

I installed LLVM-4.0.1-win64.exe on Windows 7 64-bit, and I’m trying to 
get it working with the Code::Blocks IDE.

Code::Blocks wants the following information in its toolchain entered 
into executables dialog.

What it wants                                          My best guess

C Compiler                                          clang.exe

C++ Compiler                                          clang++.exe

Linker for dynamic libs:              llvm-lib.exe

Linker for static libs:                            llvm-ar.exe

Debugger:                                          GDB/CDB debugger

                                                          (dropdown list, 
this is the only option.)

Resource compiler:                            windres.exe (not in clang 

Make program                            mingw32-make.exe (not in clang 

Are these correct? Does LLVM / Clang come with a Windows resource 
compiler and make program?

When I try to compile a main() that simply increments a number and 

using namespace std;

int main()


   int j = 0;

   for (int i = 0; i < 1000; i++) j++;

   return j - 1000;


I get the following messages:

clang++.exe -Weverything -fexceptions -O2 -c "E:\Files and 
Documents\Development\CompilerBasicTest\main.cpp" -o obj\Release\main.o

E:\Files and Documents\Development\CompilerBasicTest\main.cpp:3:17: 
warning: using directive refers to implicitly-defined namespace 'std'

using namespace std;


1 warning generated.

llvm-lib.exe -o bin\Release\CompilerBasicTest.exe obj\Release\main.o -s

ignoring unknown argument: -o

ignoring unknown argument: -s

bin\Release\CompilerBasicTest.exe: no such file or directory

Process terminated with status 1 (0 minute(s), 0 second(s))

0 error(s), 1 warning(s) (0 minute(s), 0 second(s))

So even without the standard libraries, I’m having trouble with the most 
basic compilation and building, but I have no clue what to do.

When I try to build a basic Hello World program:

#include <iostream>

using namespace std;

int main()


   cout << "Hello world!" << endl;

   return 0;


I get the following messages in the build log

-------------- Build: Release in CompilerBasicTest (compiler: LLVM Clang 

clang++.exe -Weverything -fexceptions -O2 -c "E:\Files and 
Documents\Development\CompilerBasicTest\main.cpp" -o obj\Release\main.o

E:\Files and Documents\Development\CompilerBasicTest\main.cpp:1:10: 
fatal error: 'iostream' file not found

#include <iostream>


1 error generated.

Process terminated with status 1 (0 minute(s), 0 second(s))

1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I also get a similar message for <cstdlib>. How do I get the standard C 
and C++ libraries?

Once I get basic compilation working with the standard c / c++ include 
files, I’m going to have to get it working for making actual windows 
programs. I have TDM’s MinGW. Is there anything special I need to do to 
get clang to recognize <windows.h> and other Windows OS include files, 
or do I just point the compiler search paths at MinGW?

I’m sorry if these questions have already been asked and answered, but I 
haven’t found a useful way to search the cfe-users archives. (Does the 
BSD community have an acquired allergy to off-the-shelf forum software? 
Just asking.)

Any help would be appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20170906/2ac2eedb/attachment.html>

More information about the cfe-users mailing list