Open Lennon925 opened 4 years ago
Our parser has near/far support disabled (same as the VS default). How exactly are you getting your compiler to support that? i.e. what compiler/flags? I see it used for 16-bit compilation with older Microsoft compilers.
I am using VS Code to edit the code of an old project on 80186 based µC and have the same errors with far/near pointers. It is no wonder that I can't complie my project with modern compilers but I really like the features of VS Code such as IntelliSense
A workaround would be to add "near=" and "far=" to the "defines" array in c_cpp_properties.json
This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.
I've also just run into this while working with a codebase targeting the venerable NEC V30 chip, using the Watcom compiler..
This feature request has received enough votes to be added to our backlog.
We should check if this is something easy for the IntelliSense parser to support.
@bobbrow Your suggestion to do this
"C_Cpp.default.defines": [
"near=",
"far="
]
does not solve the issue for me, unfortunately.
Does anyone have another suggestions? I am still getting the expected a ';'
or expected a ')'
error.
This probably also causes types not being resolved in other places.
@Phyioa Do you have a c_cpp_properties.json or compileCommands or configurationProvider set? Those could be overwriting the C_Cpp.default.defines. You could tell if the define is being recognized by hovering it.
@sean-mcmanus Yes, it seems like I do have a c_cpp_properties.json, which I didn't know of. It has the following contents right now.
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${default}"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.14393.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
I have neither compileCommands nor configurationProvider set.
Hovering some of the far
s I found in the code does not indicate that the defines are recognized.
Any tips on how to proceed? Thanks for your help so far! <3
@Phyioa Add "${default}" to your list of defines in c_cpp_properties.json (see https://code.visualstudio.com/docs/cpp/customize-default-settings-cpp for more info).
@sean-mcmanus Oh my god! You are a life savior! Thank you so much. <3 Works like a charm now! :)
is it OK to add the defines to c_cpp_properties.json directly, like this?
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"near=",
"far="
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
It seems to work fwiw.
error shows: "expected a ';' "