6

I like TCC because its small, requires no installation, and can be called to compile any .c file into any .exe thru start arguments of tcc.exe

So i basically need exactly that for C++

It should need no installation (it just sits in a folder, extracted from a zip), and can compile any cpp thru start arguments of the compiler exe

Also needs to be portable like TCC meaning you dont have to compile it for every pc you put it on

  • 2
    I don't think such a beast can exist: C++ is complex to parse, and requires optimizations. Any C++11 compiler has to be complex and optimizing and its standard library requires many features from the OS so cannot be tiny. See also this explanation – Basile Starynkevitch Aug 20 '18 at 5:59
  • if you don't care about performance and want to compile the code on any computer without a compiler then you should use a scripting language like powershell, VBS, Jscript or batch. Otherwise just compile the code and distribute the binary – phuclv Aug 20 '18 at 6:55
  • 1
    "you dont have to compile it for every pc you put it on" = both the compiler and your code will need to be re-compiled for each new architecture. You can't get round that, unless you compile your C++ down to byte code and have a different byte code interpreter for every architecture – Mawg Aug 20 '18 at 7:56
4

I used the compiler from DigitalMars on Windows to compile from my editor. Although I am not sure it is all you are looking for, I remember it to be about 10MB. There may be additional downloads needed, since I used it for C only.

Here is the downloads page: https://digitalmars.com/download/freecompiler.html

  • I am not sure it can be installed at an arbitrary place – Basile Starynkevitch Aug 20 '18 at 6:44
  • 2
    @BasileStarynkevitch I just unzipped it in C:\dm and put the directory with ‘dmc.exe’ on my path. – gerstemout Aug 20 '18 at 6:48
2

not sure if it's exactly small but there is TDM gcc that I have used successfully in the past. Zipped, it's 20 MB in size.

TDM-GCC is a compiler suite for Windows.

It combines the most recent stable release of the GCC toolset, a few patches for Windows-friendliness, and the free and open-source MinGW or MinGW-w64 runtime APIs to create an open-source alternative to Microsoft's compiler and platform SDK

There's an installer, but it also comes as .zip archives. It's "portable". Unzip, set the paths, and go.

It's gcc based so very widely spread standard.

  • Thanks ill check it out – Luka Kostic Aug 23 '18 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.