for this I changed my compiler to clang and included cs50 as #include "cs50.h" instead of #include <cs50.h> and it worked fine. need to include all c files in the task, eg in vs code, tasks.json file should look like:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang.exe build active file",
            "command": "C:\\mingw64\\bin\\clang.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${workspaceFolder}\\*.c",
                "-o",
                "${workspaceFolder}\\main.exe"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: C:\\mingw64\\bin\\clang.exe"
        }
    ]
}