Project management, compiling and linking C/C++ on Windows

> What is the proper toolchain for work with C and C++ on Windows?
> GCC or Clang+VS Linker? Both use makelists, are that makelists equals?
> Do you recommend me some article or resource about that issue?

I've only worked on Visual Studio, i'm very confused.

Attached: 1200px-ISO_C++_Logo.svg.png (1200x1349, 69K)

Other urls found in this thread:

gnu.org/software/make/.
gnu.org/software/automake/,
cmake.org/cmake-tutorial/
twitter.com/SFWRedditVideos

Generally the Visual C(++) compiler.

MSVC if you're doing C++, Clang/VS if you're doing C. The support for C is piss poor on MSVC (they barely support C99 as it is...) and watch out for microsoft specific extensions such as sprintf_s, it's definitely worth setting up CI (like Travis, if your project is open source) to build it on other systems.

For project management it's definitely worth learning CMake - it's a makefile language that compiles to other makefiles on any platform and even IDE projects (for example, visual studio .sln's) and provide a platform independent way of defining project structure and compiler flags. Makefiles* are just a set of instructions that turn into commands to send to the respective compiler. If you see a file called just "Makefile", you're almost always looking at gnu.org/software/make/. If you see one called "Makefile.am" + "Makefile.in" (the latter is generated from the former), you're looking at gnu.org/software/automake/, and for the love of god please don't use it.

cmake.org/cmake-tutorial/
It's also worth learning git, if you don't already know it. Even if you're working closed source it's always nice to have source control.

why the hate for automake?

tcc for C
For C++ I recommend not using it

If you only target Windows you don't need more than VS.

Hate is a strong word, I don't hate it. Autotools is really old, the syntax is pretty ugly, it's finicky and is designed to be many decades backwards compatible (and that's why GCC is in the state it is now too) and it can do absolutely nothing that CMake cannot. It *works* but there's no good reason to use it imo.

shut up suckmore weenie people with jobs are talking

>windows
>C++
The proper toolchain doesn't involve these. Use gcc and make after you switch to linux

MSVC for C++ or you can also go with msys2 for C/++ but you would have to use another ide, clion, qt, etc.

So here is the actual question: Are clang compiled C/C++ programs completely platform independent since they run in the LLVM. Or why do I need that LLVM. I tried to understand it but I didn't.

The proper tool for anything on Windows is to install Linux

>and it can do absolutely nothing that CMake cannot
I *wish* this was true. Autotools is horrible, but it also supports vastly more subtle functionality than cmake, which is why cmake still is rather limited in applicability.

you're still gonna have to compile the LLVM intermediate representation to platform specific machine code so not really

I have never used it, can you enlighten me into why?

why can't I use gcc with android ndk, why is google doing this?

If you're asking if the binaries are, no. clang complies to machine code. It only uses LLVM as an intermediate representation.
Whether C code can be compiled for different platforms depends on if your using platform specific libraries.

There's a lot of weird edge cases that autotools can do absolutely correctly, where cmake went for the simple-and-good-enough approach that simply cannot deal with the edge case at all.

For example: let's say you want to build a program, written in C++; and while building that, you first build a temporary program, also in C++, and run it, which generates part of the primary source code. Parser generators often work this way.

And let's say you want to cross compile your program. You are on an x86 machine, and you want to build your program for arm.

Then during compilation, you first want to build your temporary program *for x86*, and then run it, and afterwards compile the rest of the project *for arm*. If the temporary program is ALSO part of the final build, you need to build it twice, once for arm and once for x86.

If your project needs any libraries to build it, you need to keep careful separate track of x86 libraries and where to find them, and arm libraries and where to find them. Any libraries you need to build your temporary program are x86 libraries, and you probably want to search for them among your system libraries. Any libraries for your final program are arm libraries, and you will find them among "shit I will be shipping". If you confuse the two at any point, shit will break.

cmake cannot do this. It can cross compile, and it can build temporary programs to be used during the build; but not both at the same time. Because cmake only understands one system configuration, one target architecture, one set of libraries, etc. Because it went for the "let's not overcomplicate things" philosophy, which means it cannot solve many tricky problems at all. There are workarounds of course, but they are horrible.

Autotools can totally do this. It can also do a ton of other weird edge cases that cmake can't, but this is one I'm intimately familiar with. Because it's designed to do everything technically right, with no compromises.

unironically, why not use a shell script to setup the environment?

They're sepples fags that like to overcomplicate things because they think it makes them look smart when they find how to deal with the clusterfuck. A sane person just uses make.

I do. It's called configure.

make is another clusterfuck on it's own
enlightened use redo scripts

gurus use js grunt gulp npm and batman to manage their builds

Every clang/llvm talk ever starts by mentioning that the VM in LLVM doesn't stay for virtual machine anymore, that it was a very early concept that they abandoned but name sticked.
It's a normal native-code generating compiler.
As for what's clang and what's LLVM - LLVM has either its own low-level IR language or AST definitions library for a compiler front-end to use, and target specs. It does some optimizations and generates native code. Many languages use it. Unironically it's mostly a better language than C.
Clang parses C/C++ syntax, does semantic analysis, resolves templates and language abstractions to concrete code and translates it into the LLVM's representations. It does more ofc but this is a main purpose.

CMake is fucking shit too.