Skip to content

Conversation

AnthonyIacono
Copy link

@AnthonyIacono AnthonyIacono commented Nov 8, 2022

In order to properly build SourceMod in debug mode on Windows, we need to have the libprotobuf.lib that was linked with the MSVC 2015 toolset.

This was created using the following steps:

  1. Download the protobuf 2.5.0 ZIP file from here: https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.zip

  2. Add macro definitions for the following in common.h:

    #if defined(_WIN32) && !defined(min)
    #define min(a,b) __min(a,b)
    #define max(a,b) __max(a,b)
    #endif
    
    #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
    
  3. Open the solution file in VS 2022 and migrate it from the old file format

  4. Right click the "libprotobuf" project and...

    • Switch Platform Toolset to "Visual Studio 2015 (v140)"
    • Switch Target Platform Version to "10.0.19041.0"
    • Code Generation -> Runtime Library -> /MTd
    • Preprocessor Definitions -> Add -> _ITERATOR_DEBUG_LEVEL=0
  5. Build the libprotobuf project, and that's it!

In order to properly build SourceMod in debug mode on Windows, we need to have the `libprotobuf.lib` that was linked with the MSVC 2015 toolset.

This was created using the following steps:
1) Download the protobuf 2.5.0 ZIP file from here: https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.zip
2) Add macro definitions for the following in `common.h`:
    ```
    #if defined(_WIN32) && !defined(min)
    #define min(a,b) __min(a,b)
    #define max(a,b) __max(a,b)
    #endif

    #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
    ```

3) Open the solution file in VS 2022 and migrate it from the old file format
4) Right click the "libprotobuf" project and...
    - Switch Platform Toolset to "Visual Studio 2015 (v140)"
    - Switch Target Platform Version to "10.0.19041.0"
    - Code Generation -> Runtime Library -> /MTd
    - Preprocessor Definitions -> Add -> _ITERATOR_DEBUG_LEVEL=0
5) Build the `libprotobuf` project, and that's it!
@Kenzzer
Copy link
Member

Kenzzer commented Sep 24, 2025

Pull request is 3 years old, sorry this has been left ignored. CSGO has now moved to CS2 so I don't know if anybody still wants to build debug versions of sourcemod, nevertheless I don't think a binary file will be accepted for this repo without some previous history of contribution (this is my own assumption though, I'm not saying that's how things are). Building sourcemod has also changed, most individuals are recommended to build with vs2017 nowadays so the debug file in this PR has already and unfortunately fallen behind.

To anyone else reading this in the future, should this PR be still desired, I'm willing to build the protobuf lib myself and commit it to the repository, simply drop a ping here or open a new issue.

Thank you for the PR.

@Kenzzer Kenzzer closed this Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants