Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99046

VS Code C++: inaccurate system includePath errors (wchar.h, boost/lambda/lambda.hpp)

$
0
0

Dealing with a strange include issue here with VS Code on Mac OS Mojave 10.14.6.

include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/Users/ajm/Projects/restaurant/cpp/sim/src/main.cpp).C/C++(1696)

cannot open source file "wchar.h" (dependency of "iostream")

Note that this started happening right after I updated my MacOS CommandLineTools with xcode-select --install.

My compiler path is in VS Code is

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++

And my includePath is

${workspaceFolder}/**
${BOOST_ROOT}/**

when I add /Library/Developer/CommandLineTools/usr/include/c++/v1/** to my includePath and change my compiler path to /usr/bin/g++, the STL include problems go away, and I get this:

cannot open source file "boost/lambda/lambda.hpp"

Note that when I build the program from the command line, it works perfectly; everything is found as it should be.

This is my Makefile:

PROG = sim
CC = g++
CPPFLAGS = -g -Wall -I$(SDIR) -I$(ODIR) -I$(BOOST_ROOT)
ODIR = ./bin
SDIR = ./src
OBJS = $(ODIR)/main.o

$(PROG) : $(OBJS)
        $(CC) $(CPPFLAGS) -o $(PROG) $(OBJS)
$(ODIR)/%.o : $(SDIR)/%.cpp
        $(CC) $(CPPFLAGS) -c $< -o $@

output from running make:

g++ -g -Wall -I./src -I./bin -I/usr/local/boost_1_72_0 -c src/main.cpp -o bin/main.o
g++ -g -Wall -I./src -I./bin -I/usr/local/boost_1_72_0 -o sim ./bin/main.o

And my simple program, main.cpp:

#include <iostream>
#include <boost/lambda/lambda.hpp>

int main()
{
    using namespace boost::lambda;
    std::cout << "Hello World!\n";
    return 0;
}

This is not a do-or-die issue; I am really just wondering why VS Code is failing to properly locate include headers. My code still works, but red squigglies are quite annoying when they're not accurate. I'd rather not turn them off, because when they are right, they are helpful.

If this is not the correct place to be posting this issue, please let me know; I can post this somewhere else.

Let me know if you need more detail. Thanks in advance for your help.

Cheers


Viewing all articles
Browse latest Browse all 99046

Latest Images

Trending Articles



Latest Images