Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macFrameworkPath isn't working? #3323

Closed
sean-mcmanus opened this issue Mar 20, 2019 · 15 comments
Closed

macFrameworkPath isn't working? #3323

sean-mcmanus opened this issue Mar 20, 2019 · 15 comments
Labels
bug investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service

Comments

@sean-mcmanus
Copy link
Collaborator

Unfortunately this feature seems to not work on my side,

As you can see i tried different things, put the root folder or frameworks/headers directories directly.
The result is always the same.

If i switch "fuzzy" mode on & off the result is the same (well in fuzzy mode it's underlined in green with a message telling to update includePath). Did I miss something ?

OSX 10.14.3
VSCode 1.32.3
CPP Tools 0.21.0

Originally posted by @jbltx in #970 (comment)

@sean-mcmanus sean-mcmanus added bug Language Service investigate: repro This issue's repro steps needs to be investigated/confirmed labels Mar 20, 2019
@sean-mcmanus sean-mcmanus changed the title macFramework path isn't working? macFrameworkPath isn't working? Mar 20, 2019
@jbltx
Copy link

jbltx commented Mar 21, 2019

As I said in #970 (comment), it seems there's a difference between writing manually the Headers path in the configuration file, and clicking the suggestion given by the tool in any #include. Only the suggestion clear the errors.
To more, I think the suggestion shouldn't be the real Headers path, but a Framework one.

I can take a look at the code this evening if there's no assignee yet.

@sean-mcmanus
Copy link
Collaborator Author

The code action is implemented in the addToIncludePathCommand method in our open source (https://github.com/Microsoft/vscode-cpptools/blob/master/Extension/src/LanguageServer/configurations.ts), but it basically just writes to the c_cpp_properties.json, so I don't know why the behavior would be different.

@julee
Copy link

julee commented Mar 24, 2020

Any news? It's Troublesome

@sean-mcmanus
Copy link
Collaborator Author

@julee What issue are you hitting? I don't think we found a repro for this issue. Can you provide more repro info?

@julee
Copy link

julee commented Mar 26, 2020

@julee What issue are you hitting? I don't think we found a repro for this issue. Can you provide more repro info?

Project:
vs_sample.zip

you may edit the .vscode/setting.json , change Qt5_DIR to the correct path:

{
    "cmake.configureArgs": [
        "-DQt5_DIR=/Users/julee/Qt5.10.1/5.10.1/clang_64/lib/cmake/Qt5"
    ],
    "C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools"
}

After cmake: configure the project, Qt head files cannot find by vscode, though all include path are detected.

image

C/C++ Log Diagnostics output:

-------- Diagnostics - 3/26/2020, 10:02:58 AM
Version: 0.26.3
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "macFrameworkPath": [
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
    ],
    "compilerPath": "/usr/bin/clang",
    "knownCompilers": [
        {
            "path": "/usr/bin/clang",
            "isC": true
        },
        {
            "path": "/usr/bin/clang++",
            "isC": false
        },
        {
            "path": "/usr/bin/gcc",
            "isC": true
        },
        {
            "path": "/usr/bin/g++",
            "isC": false
        },
        {
            "path": "/usr/bin/cpp",
            "isC": false
        },
        {
            "path": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang",
            "isC": true
        },
        {
            "path": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
            "isC": false
        },
        {
            "path": "/usr/bin/clang",
            "isC": false
        }
    ],
    "cStandard": "c11",
    "cppStandard": "c++17",
    "intelliSenseMode": "clang-x64",
    "compilerArgs": [],
    "configurationProvider": "vector-of-bool.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /Volumes/SSD/code/issue_test/vs_sample/main.cc ]:
    /Volumes/SSD/code/issue_test/vs_sample/main.cc
Translation Unit Configurations:
[ /Volumes/SSD/code/issue_test/vs_sample/main.cc ]:
    Process ID: 73493
    Memory Usage: 7 MB
    Compiler Path: /usr/bin/clang++
    Includes:
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtWidgets.framework
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtGui.framework
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtGui.framework/Versions/5/Headers
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtCore.framework
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtCore.framework/Versions/5/Headers
        /Users/julee/Qt5.10.1/5.10.1/clang_64/mkspecs/macx-clang
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
    Frameworks:
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
    Defines:
        QT_CORE_LIB
        QT_GUI_LIB
        QT_WIDGETS_LIB
    Standard Version: c++11
    IntelliSense Mode: clang-x64
    Other Flags:
        --clang
        --clang_version=110000
Total Memory Usage: 7 MB

-------- Diagnostics - 3/26/2020, 10:06:58 AM
Version: 0.26.3
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "macFrameworkPath": [
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
    ],
    "compilerPath": "/usr/bin/clang",
    "knownCompilers": [
        {
            "path": "/usr/bin/clang",
            "isC": true
        },
        {
            "path": "/usr/bin/clang++",
            "isC": false
        },
        {
            "path": "/usr/bin/gcc",
            "isC": true
        },
        {
            "path": "/usr/bin/g++",
            "isC": false
        },
        {
            "path": "/usr/bin/cpp",
            "isC": false
        },
        {
            "path": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang",
            "isC": true
        },
        {
            "path": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
            "isC": false
        },
        {
            "path": "/usr/bin/clang",
            "isC": false
        }
    ],
    "cStandard": "c11",
    "cppStandard": "c++17",
    "intelliSenseMode": "clang-x64",
    "compilerArgs": [],
    "configurationProvider": "vector-of-bool.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /Volumes/SSD/code/issue_test/vs_sample/main.cc ]:
    /Volumes/SSD/code/issue_test/vs_sample/main.cc
Translation Unit Configurations:
[ /Volumes/SSD/code/issue_test/vs_sample/main.cc ]:
    Process ID: 73587
    Memory Usage: 7 MB
    Compiler Path: /usr/bin/clang++
    Includes:
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtWidgets.framework
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtGui.framework
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtGui.framework/Versions/5/Headers
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtCore.framework
        /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtCore.framework/Versions/5/Headers
        /Users/julee/Qt5.10.1/5.10.1/clang_64/mkspecs/macx-clang
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
    Frameworks:
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
    Defines:
        QT_CORE_LIB
        QT_GUI_LIB
        QT_WIDGETS_LIB
    Standard Version: c++11
    IntelliSense Mode: clang-x64
    Other Flags:
        --clang
        --clang_version=110000
Total Memory Usage: 7 MB

@julee
Copy link

julee commented Apr 15, 2020

@sean-mcmanus Any news for this issue?

@sean-mcmanus
Copy link
Collaborator Author

I'm not sure if anyone investigated this yet. What is the exact error message, i.e. which header is missing? QtGui/QGuiApplication or a dependency of that ? Where is the file located? At one of the paths in the "Includes" in your logs?

@julee
Copy link

julee commented Apr 16, 2020

I'm not sure if anyone investigated this yet. What is the exact error message, i.e. which header is missing? QtGui/QGuiApplication or a dependency of that ? Where is the file located? At one of the paths in the "Includes" in your logs?

QtGui/QGuiApplication not found. it's locate at: /Users/julee/Qt5.10.1/5.10.1/clang_64/lib/QtGui.framework/Versions/5/Headers

@julee
Copy link

julee commented Apr 16, 2020

@sean-mcmanus You can try that demo project with macOS, just edit the .vscode/setting.json ,set Qt5_DIR to correct path, you can find the bug

@bobbrow
Copy link
Member

bobbrow commented Apr 16, 2020

I think the problem is that /Users/julee/Qt5.10.1/5.10.1/clang_64/lib is not being added as a framework path. This looks like a bug with CMake Tools.

@bobbrow
Copy link
Member

bobbrow commented Apr 16, 2020

You could write it as #include <QGuiApplication> to make IntelliSense work, but I don't know if that will compile for you.

@julee
Copy link

julee commented Apr 16, 2020

You could write it as #include <QGuiApplication> to make IntelliSense work, but I don't know if that will compile for you.

use #include <QGuiApplication> Wont' work, it says:
can't open "QtGui/qtguiglobal.h" (dependency of "QGuiApplication").

@julee
Copy link

julee commented Apr 16, 2020

I think the problem is that /Users/julee/Qt5.10.1/5.10.1/clang_64/lib is not being added as a framework path. This looks like a bug with CMake Tools.

Yes, you are right! It's a bug with CMake Tools.
I try remove "configurationProvider": "vector-of-bool.cmake-tools", and add: "compileCommands": "${workspaceFolder}/build/compile_commands.json"
It works now!

Thanks you!

@bobbrow
Copy link
Member

bobbrow commented Apr 16, 2020

use #include <QGuiApplication> Wont' work, it says:
can't open "QtGui/qtguiglobal.h" (dependency of "QGuiApplication").

Ah yes, that's a problem if the dependencies are all using the framework syntax. 🤦‍♂️ Thanks for opening the bug for CMake Tools.

@bobbrow bobbrow closed this as completed Apr 16, 2020
@julee
Copy link

julee commented Apr 17, 2020

use #include <QGuiApplication> Wont' work, it says:
can't open "QtGui/qtguiglobal.h" (dependency of "QGuiApplication").

Ah yes, that's a problem if the dependencies are all using the framework syntax. 🤦‍♂️ Thanks for opening the bug for CMake Tools.

Open a issue:
CMake Tool Issue: Require Pass -iframework Options to C/C++ Extension

@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service
Projects
None yet
Development

No branches or pull requests

4 participants