Raylib issue mac

Hi there, i’m taking the C++ fundamentals course and am using a Mac (Monteray & Intel Chip) - i’ve got as far section 10 where we have to include raylib.

Raylib has been installed via brew, and i am using the vscode template from the gitlab repo.

When i try to build my code i get the following error:

Undefined symbols for architecture x86_64:
  "_InitWindow", referenced from:
      _main in main-884f8f.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

My c_cpp_properties file is included below:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/raylib/raylib/src/**",
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "GRAPHICS_API_OPENGL_33",
                "PLATFORM_DESKTOP"
            ],
            "compilerPath": "C:/raylib/w64devkit/bin/gcc.exe",
            "cStandard": "c99",
            "cppStandard": "c++14",
            "intelliSenseMode": "gcc-x64"
        },
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/local/include/",
                "/usr/local/Cellar/raylib/4.2.0/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "GRAPHICS_API_OPENGL_33",
                "PLATFORM_DESKTOP"
            ],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang++",
            "cStandard": "c11",
            "cppStandard": "c++14",
            "intelliSenseMode": "macos-clang-x64"
        },
        {
            "name": "Linux",
            "includePath": [
                "/home/linuxbrew/.linuxbrew/include",
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "GRAPHICS_API_OPENGL_33",
                "PLATFORM_DESKTOP"
            ],
            "cStandard": "c11",
            "cppStandard": "c++14",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

Please could you provide some pointers as I am now stuck and cannot proceed with the course, which makes me sad.

Thanks

Can you show me your code? I’m hoping that raylib was not compiled for 32-bit systems, which has been killed with Big-Sur and Montery.

Hi Tuomo_T.

I researched this quite a lot and tried various things, I don’t believe this was an architecture issue.

I managed to get my code building by adding "pkg-config --libs --cflags raylib", to my cppbuild args in tasks.json.

I’m not sure this was the best solution but it seems to be working for me, I did this because on the raylib docs for mac https://github.com/raysan5/raylib/wiki/Working-on-macOS it mentioned that command.

I’d be interested in hearing your thoughts on this work around.

I’m honestly not that knowledgeable on the nitty-gritty of compiler flags so I can’t give an opinion. That said, official raylib docs can definitely be trusted to find useful solutions and it’s good for us to know as well if this keeps becoming an issue as we can add those flags to the template.

Good work on finding a solution!

Ok, thanks for taking the time to respond anyway. As i said it’s working for me, so i’ll mark the post a solution in case anyone else stumbles across this thread with the same issue.

Thanks again.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms