sokol-samples: Incorrect subsystem on windows with VS2022

Just following the basic guide:

> mkdir ~/scratch
> cd ~/scratch
> git clone https://github.com/floooh/sokol-samples
> cd sokol-samples
> ./fips set config sapp-d3d11-win64-vstudio-debug
> ./fips build

=> error LNK2019: unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)

The reason is that the main hijack is not working, because it’s being overridden by the project subsystem, which is set to Console (instead of NotSet).

    <Link>
      ...
      <SubSystem>Console</SubSystem>
    </Link>

If I change the SubSystem to Windows or NotSet then it works, but it would be nice if the tool could do it automatically, of if the hijack could override that setting.

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

Ok, one last thing before I hit the sack:

Can you add a couple of debug-messages to the fips directory that’s been checked out next to sokol-samples:

…in fips/cmake/fips.cmake around line 164:

    if (NOT CMAKE_TOOLCHAIN_FILE)
        message("######### in NOT CMAKE_TOOLCHAIN_FILE")
        if (FIPS_HOST_WINDOWS)
            message("######### including windows.cmake")
            include(${FIPS_ROOT_DIR}/cmake-toolchains/windows.cmake)
        elseif (FIPS_HOST_OSX)
            message("######### including osx.cmake")
            include(${FIPS_ROOT_DIR}/cmake-toolchains/osx.cmake)
        else()
            message("######### including linux.cmake")
            include(${FIPS_ROOT_DIR}/cmake-toolchains/linux.cmake)
        endif()
    endif()

… then run fips gen in the sokol-samples directory. Here it looks like this:

FIPS_PROJECT_DEPLOY_DIR: E:/scratch/fips-deploy/sokol-samples/sapp-d3d11-win64-vstudio-debug
Host system: Windows
CMAKE_CXX_COMPILER_ID: MSVC
FIPS_MSVC: 1
######## in NOT CMAKE_TOOLCHAIN_FILE
######### including windows.cmake
FIPS_PLATFORM: WIN64
FIPS_PLATFORM_NAME: win64
-- Configuring done (0.5s)

I basically want to check if windows.cmake is actually included.

Btw, can you also check this project:

https://github.com/floooh/pacman.c

This isn’t using my fips cmake wrapper but a regular CMakeLists.txt instead. Build instructions are in the readme. If this also fails (which I don’t expect), then it would be some incompatibility between cmake and the latest VS (unlikely though).