Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the alternative for cl /NODEFAULTLIB in gcc

I have done a c++ project that doesn't depend on any c/c++ runtime but only windows api I can build it easily with msvc by passing -NODEFAULTLIB to the linker and I end up with a small executable that doesn't depend on any c/c++ runtime I'm thinking now to publish my project and people will be able to build it without msvc (it requires huge disk space) So I decided to go with mingw-w64 and my project will be built also on linux with mingw But I don't want the runtime library to be linked to my application so how can I disable linking to it

like image 752
dev65 Avatar asked Dec 01 '25 01:12

dev65


1 Answers

-z nodefaultlib seems to do it, see:

http://rextester.com/SAL68483

Reference:

https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options

like image 103
Paul Sanders Avatar answered Dec 02 '25 14:12

Paul Sanders