Skip to content

(info) Compiling without VS - With GCC #22

Description

@HumbleDeer

If you are compiling without Visual Studio/MSVC, you will have to add the linked library for WinSockets yourself; Visual Studio's compiler uses a pragma system, GCC does not.
VS: #pragma comment(lib, "ws2_32")

For myself in CodeBlocks, this means:

  • Cloning a fresh repo (ensure no cmake garbage is left)
  • Creating a new project and including all folders and files
  • Project -> Build Options -> Linker
  • Add "ws2_32" as a library; no path or .lib

For projects compiling with libraries linked in the GCC Commandline, use -L"ws2_32"

The project should now compile without "_imp." errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions