raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
22.03k stars 2.22k forks source link

[build] Option to Remove Console #324

Closed msmshazan closed 7 years ago

msmshazan commented 7 years ago

Please add option to remove console for shipping build of the game.

raysan5 commented 7 years ago

Hiding the console is a compiler/linker configuration parameter.

When compiling with GCC, the parameter is -Wl,--subsystem,windows or just -mwindows

When compiling with MSVC (Visual Studio) use /SUBSYSTEM:WINDOWS /ENTRY:main on linker configuration.

msmshazan commented 7 years ago

@raysan5 I added the linker flags to MSVC you said but the i get these errors.

build.bat
main.cpp
glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp__free
main.obj : error LNK2001: unresolved external symbol __imp__free
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __imp__free
glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol __imp__free
main.obj : error LNK2001: unresolved external symbol __imp__malloc
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__malloc
main.obj : error LNK2001: unresolved external symbol _memcpy
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol _memcpy
main.obj : error LNK2001: unresolved external symbol __imp__memmove
raylib.lib(utils.obj) : error LNK2001: unresolved external symbol __imp__memmove
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol _memset
glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol _memset
glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol _memset
main.obj : error LNK2001: unresolved external symbol _memset
glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol _memset
glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol _memset
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol _memset
main.obj : error LNK2001: unresolved external symbol __imp__strchr
main.obj : error LNK2001: unresolved external symbol _strlen
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__ftell
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fputc
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__srand
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fopen
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fclose
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fseek
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__rand
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__strncpy
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp___chdir
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__rewind
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp___getcwd
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fwrite
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fopen_s
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fputs
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp___time64
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fmaxf
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__round
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fminf
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__fread
raylib.lib(core.obj) : error LNK2001: unresolved external symbol __imp__strrchr
glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
raylib.lib(textures.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
raylib.lib(textures.obj) : error LNK2001: unresolved external symbol __imp__realloc
glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp__realloc
raylib.lib(textures.obj) : error LNK2001: unresolved external symbol __imp__strncmp
glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __imp__strncmp
raylib.lib(textures.obj) : error LNK2001: unresolved external symbol __imp__strtol
raylib.lib(textures.obj) : error LNK2001: unresolved external symbol __imp__ldexp
raylib.lib(textures.obj) : error LNK2001: unresolved external symbol __imp__feof
raylib.lib(text.obj) : error LNK2001: unresolved external symbol __imp__fgets
raylib.lib(text.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsprintf
glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsprintf
raylib.lib(text.obj) : error LNK2001: unresolved external symbol __imp__strstr
glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __imp__strstr
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__strstr
raylib.lib(text.obj) : error LNK2001: unresolved external symbol __imp__strncat
raylib.lib(text.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsscanf
glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsscanf
raylib.lib(utils.obj) : error LNK2001: unresolved external symbol __imp__exit
raylib.lib(utils.obj) : error LNK2001: unresolved external symbol __imp____acrt_iob_func
raylib.lib(utils.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vfprintf
raylib.lib(utils.obj) : error LNK2001: unresolved external symbol __imp__frexp
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp__qsort
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__qsort
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __libm_sse2_pow_precise
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __libm_sse2_sqrt_precise
MSVCRT.lib(_ftol3_.obj) : error LNK2001: unresolved external symbol __except1
rfxgen.exe : fatal error LNK1120: 47 unresolved externals
raysan5 commented 7 years ago

In the project build linker options set:

/SUBSYSTEM:WINDOWS 
/ENTRY:mainCRTStartup
CarlVitasa commented 2 years ago

Hiding the console is a compiler/linker configuration parameter.

When compiling with GCC, the parameter is -Wl,--subsystem,windows or just -mwindows

When compiling with MSVC (Visual Studio) use /SUBSYSTEM:WINDOWS /ENTRY:main on linker configuration.

What is the equivalent for Mac?

msmshazan commented 2 years ago

Hiding the console is a compiler/linker configuration parameter.

When compiling with GCC, the parameter is -Wl,--subsystem,windows or just -mwindows

When compiling with MSVC (Visual Studio) use /SUBSYSTEM:WINDOWS /ENTRY:main on linker configuration.

What is the equivalent for Mac?

Check this Stack overflow answer https://stackoverflow.com/a/23870490

Unterfrauner commented 1 year ago

But the problem is that this does also disable other prints to the console

ShreyasMahesh commented 1 year ago

I am using GCC. I used -Wl,--subsystem,windows and -mwindows but nothing works.

This is my makefile:

debug:
    g++ -c src/*.cpp -g -std=c++2b -Wall -m64 -I include && g++ *.o -o bin/debug/main -L lib -lraylib -lopengl32 -lgdi32 -lwinmm && start bin/debug/main.exe

release:
    g++ -c src/*.cpp -O3 -std=c++2b -Wall -m64 -Wl,--subsystem,windows -mwindows -I include && g++ *.o -o bin/release/main -L lib -lraylib -lopengl32 -lgdi32 -lwinmm && start bin/release/main.exe

clean:
    rm bin/debug/main.exe
    rm bin/release/main.exe