VS Code can't include wx/wx.h file? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
pigLoveRabbit
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Jun 27, 2022 1:35 am

VS Code can't include wx/wx.h file?

Post by pigLoveRabbit »

wxWidgets-3.2.2.1
windows10

I have compiled wxWidgets on my computer via MinGW-x64, here is my vscode c_cpp_properties.json

Code: Select all

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/src/**",
                "${env:WXWIN}/include/**",
                "${env:WXWIN}/lib/gcc_lib/mswud/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "D:\\software\\x86_64-7.3.0-release-win32-seh-rt_v5-rev0\\mingw64\\bin\\g++.exe",
            "cStandard": "c11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}
But I still got the error: cannot open source file "../../../lib/vc_lib/mswud/wx/setup.h"
problem
problem
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: VS Code can't include wx/wx.h file?

Post by PB »

You should fix your include paths so that they do not have the msvc folder with the MSVC-specific setup in it. As the name implies, that setup is not for GCC but for MSVC, where it tries to include the build-specific setup.h from MSVC-built library.
pigLoveRabbit
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Jun 27, 2022 1:35 am

Re: VS Code can't include wx/wx.h file?

Post by pigLoveRabbit »

PB wrote: Wed Mar 29, 2023 5:16 am You should fix your include paths so that they do not have the msvc folder with the MSVC-specific setup in it. As the name implies, that setup is not for GCC but for MSVC, where it tries to include the build-specific setup.h from MSVC-built library.
Why vscode tries to include MSVC-built library? How to force the vscode to include gcc library?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: VS Code can't include wx/wx.h file?

Post by PB »

Please read my answer again.

I am not familiar with VSCode JSON syntax but it seems you add to the compiler include paths all the folders in WXWIN/include folder, which has folders msvc and wx.

When your compiler tries to find setup.h, it finds one in WXWIN/include/msvc, which of course, being MSVC-specific setup.h, tries to include the MSVC build-specific setup.h, which does not exist.

Once again, fix your build setup so that your include paths do not end containing WXWIN/include/msvc. Perhaps by removing those trailing asterisks?
pigLoveRabbit
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Jun 27, 2022 1:35 am

Re: VS Code can't include wx/wx.h file?

Post by pigLoveRabbit »

PB wrote: Wed Mar 29, 2023 8:39 am Please read my answer again.

I am not familiar with VSCode JSON syntax but it seems you add to the compiler include paths all the folders in WXWIN/include folder, which has folders msvc and wx.

When your compiler tries to find setup.h, it finds one in WXWIN/include/msvc, which of course, being MSVC-specific setup.h, tries to include the MSVC build-specific setup.h, which does not exist.

Once again, fix your build setup so that your include paths do not end containing WXWIN/include/msvc. Perhaps by removing those trailing asterisks?
yes, you are right
change

Code: Select all

"${env:WXWIN}/include/**"
to

Code: Select all

"${env:WXWIN}/include"
,
Post Reply