Make VS Code Intellisense work with wxwidgets

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
medusa1414
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Mar 18, 2015 3:19 pm

Make VS Code Intellisense work with wxwidgets

Post by medusa1414 » Mon Sep 09, 2019 2:04 pm

Anyone made intellisense work with wxwidgets?
I am using VS Code. Windows 7. wxWidgets 3.1.2 built with mingw.

As mentioned, i use vs code. I am trying to make intellisense work with wxwidgets. The code compiles (using Makefile and g++) and runs fine, only a problem with code completion/hints. Simple program with "wx/wx.h" at top.

Error:

Code: Select all

cannot open source file "../../../lib/vc_lib/mswu/wx/setup.h" (dependency of "wx/wx.h")C/C++(1696)
Path defined on line 117 in msvc/wx/setup.h

Code: Select all

wxCONCAT6(../../../lib/,wxLIB_SUBDIR,/,wxTOOLKIT_PREFIX,wxSUFFIX,/wx/setup.h)
The problem is, it looks in the wrong lib dir, it is supposed to look in "gcc_lib", not "vc_lib".
I dont know how microsoft software "does this", but i would love to know what is actually happening, because all other non-microsoft editors i have tried like codelite, codeblocks and slickedit includes from the correct lib, "gcc_lib".

I have tried setting different variables, in the "defines" part in the c_cpp_properties.json file, i also tried changing the wxLIB_SUBDIR in "defines", but it has no effect.

It currently looks like this:

Code: Select all

{
    "configurations": [
        {
            "name": "Win64",
            "includePath": [
                "${workspaceFolder}/**",
                "D:/Programing_Libs/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include",
                "D:/Programing_Libs/mingw/mingw64",
                "D:/Programing_Libs/wxWidgets-3.1.2/include",
                "D:/Programing_Libs/wxWidgets-3.1.2/include/msvc"
            ],
            "defines": [
                "",
                "_UNICODE"
            ],
            "compilerPath": "D:/Programing_Libs/mingw/mingw64/bin/g++.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "compilerArgs": [],
            "browse": {
                "path": [
                    "${workspaceFolder}/**"
                ],
                "limitSymbolsToIncludedHeaders": true
            }
        }
    ],
    "version": 4
}

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 269
Joined: Fri Nov 03, 2006 2:00 pm

Re: Make VS Code Intellisense work with wxwidgets

Post by stahta01 » Tue Sep 10, 2019 2:29 am

No idea if this link might help you.
https://code.visualstudio.com/docs/cpp/config-mingw

Tim S.

medusa1414
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Mar 18, 2015 3:19 pm

Re: Make VS Code Intellisense work with wxwidgets

Post by medusa1414 » Tue Sep 10, 2019 7:57 am

I ended up just editing the last else statement in setup.h (wxMSVC_VERSION) to minimize the effects of the change.
Now intellisense works normal. Seems like its is impossible to undefine the predefined macros windows software uses.
So i did it like this:

Code: Select all

#else
    #ifdef __INTELLISENSE__
        #define wxCOMPILER_PREFIX gcc
    #else
        #define wxCOMPILER_PREFIX vc
    #endif
#endif
Since the __INTELLISENSE__ flag is set when a intellisense editor is used.
I built wxwidgets with gcc, so gcc dir is what I need intellisense to use also.

Post Reply