I am trying to program on vscode on wsl-2 ubuntu distro. I think I did setup the system correctly, but I keep getting red squiggles on identifiers that are in libraries I included in the code. The code looks like this:
#include <iostream>
#include <stddef.h>
#include <cstring>
#include "string.h"
String::String () {
this->data=NULL;
this->length=0;
}
String::String (const String &str) {
if (str.data==NULL || str.length==0) {
this->data=NULL;
this->length=0;
} else {
this->length = str.length;
this->data = new char [str.length+1];
strncpy(this->data, str.data, str.length+1);
}
}
String::String (const char *str) {
if (str==NULL) {
this->data=NULL;
this->length=0;
} else {
this->length = strlen(str);
this->data = new char [strlen(str)+1];
strncpy(this->data, str, this->length+1);
}
}
I get errors on NULL, strncpy, strlen and such.
This is the cpp json file:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/linux"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++20",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
I tried to look all over the internet, no problem looks like this. And I do believe I installed all prerequisites. Screenshot of the code errors
Anyone has an idea why this can happen?