I technically fixed this but my fix is really bad and I should probably be stabbed for it. Any 24-bit ints I use in Visual Studio Code show up as <error-type> when I view the variables they define. I went to their definition in the CEdev toolchain and found that the #ifdef was keeping the uint24_t definitions from occuring, so I did this:
Code:
//#ifdef          __INT24_TYPE__
typedef         __INT24_TYPE__                       int24_t;
#define           INT24_MIN                      (~__INT24_MAX__)
#define           INT24_MAX                        __INT24_MAX__
#define           INT24_WIDTH         __STDINT_WIDTH(INT24)
#define           INT24_C(C)           __STDINT_C(C, INT24)
typedef        __UINT24_TYPE__                      uint24_t;
#define          UINT24_MAX                       __UINT24_MAX__
#define          UINT24_WIDTH        __STDINT_WIDTH(UINT24)
#define          UINT24_C(C)          __STDINT_C(C, UINT24)
//#endif        /*__INT24_TYPE_*/

I commented out the #ifdef and #endif so that it always defined it the way I want it too. That's clearly a bad idea. Now I can autofill 24-bit values from my structs and everything compiles the same. I don't do anything else with C++ (currently) but I worry that this could break definitions for future projects. Do I need to mess with my include-path some more? Googling gives me nothing specific.
https://stackoverflow.com/questions/71620067/for-c-c-syntax-highlighting-in-vscode-how-to-tell-vscode-that-a-compile-opti
I fixed this issue by setting the compiler path to my ez80-clang compiler:

Code:
"compilerPath": "${CEDEV}/bin/ez80-clang"

VSCode automatically figured it out or something.
Thanks Mateo and Jolly, I've tried both options and only Mateo's works (but not to the extent I like). For future reference all you have to do is open your project's folder in VS Code and hit ctrl+shift+p, select C/C++: Edit Configurations (UI), go to "Definitions" and paste this in:
Code:
__INT24_TYPE__ = int24_t
__UINT24_TYPE__ = uint24_t

It works, but only for the project you open it in. If you're like me and just rip into the files without opening the folder then it won't pick up the definitions despite them being the files in the project. If there's a global way to silence it that would be nice, but thanks for the help you guys!
This is defined by the compiler - you shouldn't try to be defining things yourself?
King Dub Dub wrote:
Thanks Mateo and Jolly, I've tried both options and only Mateo's works (but not to the extent I like). For future reference all you have to do is open your project's folder in VS Code and hit ctrl+shift+p, select C/C++: Edit Configurations (UI), go to "Definitions" and paste this in:
Code:
__INT24_TYPE__ = int24_t
__UINT24_TYPE__ = uint24_t

It works, but only for the project you open it in. If you're like me and just rip into the files without opening the folder then it won't pick up the definitions despite them being the files in the project. If there's a global way to silence it that would be nice, but thanks for the help you guys!

Does the compiler setting not work? It works like a charm in my projects... My .vscode/c_cpp_properties.json looks like this:

Code:
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${CEDEV}/include"
            ],
            "defines": [],
            "compilerPath": "${CEDEV}/bin/ez80-clang",
            "cStandard": "gnu17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-clang-x64"
        }
    ],
    "version": 4
}

I think you also need to add "${CEDEV}/include" into the includePath? Not sure though...
Yes jollyroger182's configuration seems like the way to go and the only things to add/change, nothing in the toolchain itself should be changed.
Well here's what mine looks like with the include and compiler paths set:
Code:
{
    "configurations": [
        {
            "name": "Win64",
            "includePath": [
                "${default}",
                "${CEDEV}\\include"
            ],
            "defines": [
                "__INT24_TYPE__ = int24_t",
                "__UINT24_TYPE__ = uint24_t"
            ],
            "compilerPath": "${CEDEV}\\bin\\ez80-clang",
            "cStandard": "gnu17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "windows-clang-x64"
        }
    ],
    "version": 4
}

Only the defines have any effect, removing them makes all int24's show up as an <error-type>. I also claims it can't find the CEDEV variable but seems to be using it just fine. Replacing it with C:/CEdev fixes the error but doesn't change behavior.
Did you actually *create* a CEDEV variable in Windows that points to the install? Using the one jollyroger182 provided works just fine for me.
I have a CEDEV variable for both my user and the system variables. Hitting [Win]+R and entering %CEDEV% opens up the right location. I've also replaced the variable with "C:/CEdev" and still get "Unable to resolve configuration with compilerPath "C:\CEdev\bin\ez80-clang". Using "C:\MinGW\bin\gcc.exe" instead." on the terminal. A one-to-one copy of Jolly's gives the same thing.
it should point to C:\CEdev\bin\ez80-clang.exe for Windows
Made the change, same error.
I don't know how VSC on Windows deals with variables, should you use %CEDEV% instead of ${CEDEV} maybe? I am using VSCode on Windows but all my coding is done via Remote SSH on a Linux machine.
Edit: I tried on Windows and this configuration worked for me:
Code:
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Tools\\CEdev\\include"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-clang-x64",
            "compilerPath": "C:\\Tools\\CEdev\\bin\\ez80-clang"
        }
    ],
    "version": 4
}
That isn't working either, and I've tried using %CEDEV% and \\ as well just in case VSCode wasn't playing nice with windows, which it hasn't done before. I'm gonna hit it with RevoUninstaller to blow away everything VSCode related and do a fresh install, I know I've copied over some setup files from multiple windows installs and there honestly could be some bad files somewhere.
I got it working and I don't know how, and it's global too! If you don't want to open a folder, all you have to do is open up settings, select C/C++ intellisense from you extensions and make sure the compiler and include path are set. You have to use backslashes ( \ ) for it to work, oddly enough this is one of the few Microsoft applications that seems to care. I had tried this previously, but only after blowing away every last VSCode file and reinstalling did it work. Not sure what caused it, but I guess something somewhere got left behind or corrupted from 2 of my drives going out. Thanks to you all and those in SAX at the time!

  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement