Skip to content
The Chat Archive
gpt-3.5-turbo-0301· OpenAI WildChat-4.8M (AI2)

libSDL2main.a(SDLwindowsmain.c.obj):(.text+0x9c): undefined reference to `SDL_strlen'

  1. User

    libSDL2main.a(SDL_windows_main.c.obj):(.text+0x9c): undefined reference to `SDL_strlen'

  2. Assistant

    This error means that the linker was unable to find a reference to the function "SDL_strlen" in the static library file "libSDL2main.a".

    One possible solution is to ensure that you have linked against the appropriate libraries and include directories needed by SDL2, as well as the standard library for C/C++.

    You may also need to ensure that you have included the appropriate headers and source files for SDL2 in your project.

    If the issue persists, you may need to recompile SDL2 and ensure that the "SDL_strlen" function is included in the library file.

  3. User

    msys2 ucrt/lib mingw64/lib 区别是什么

  4. Assistant

    msys2 is a software distribution and development platform typically used on Windows systems, which provides a Unix-like environment and a package management system.

    ucrt/lib is the directory in the Microsoft Visual Studio installation, which contains the Universal C Runtime (UCRT) library files.

    mingw64/lib is the directory containing the library files for the 64-bit MinGW-w64 compiler toolchain. MinGW-w64 is a free, open-source software development environment for creating native Windows applications.

    Therefore, the primary difference between these directories is that ucrt/lib contains Microsoft Visual C++ libraries, while mingw64/lib contains MinGW-w64 libraries.

  5. User

    export PATH=$PATH:/mingw64/bin/ 具体意思

  6. Assistant

    export PATH=$PATH:/mingw64/bin/ is a command in Linux, macOS, or other Unix-like operating systems which adds the /mingw64/bin/ directory to your environment's PATH variable.

    PATH is a system environment variable that contains a list of directories separated by the colon : character. When you run a command in the terminal, the system looks for that command in all the directories listed in the PATH variable.

    The command export is used to set the environment variables and make them available to other processes and commands in the shell.

    So, with the command export PATH=$PATH:/mingw64/bin/, you are adding the /mingw64/bin/ directory to the PATH variable, allowing you to run any executable files located in that directory from anywhere in the terminal.

  7. User

    是否只是临时有效? 当关闭终端后再打开, 是不是就无效了

  8. Assistant

    是的,这个变量设置只是在当前终端窗口中有效。当你关闭终端后再打开,所有的环境变量都被重置为默认值。如果你希望每次打开终端时都能保留这个变量设置,你可以将这个命令添加到一个配置文件中,例如 ~/.bashrc 或 ~/.bash_profile 文件,这样每次打开终端时都会自动加载这些配置。