Clang ++可以在CLion上正常工作,但不能使用VSCode

时间:2020-03-30 13:00:24

标签: c++ visual-studio-code clang

我试图从单独的IDE过渡到一个可以用于所有功能(Python,C ++和Web)的单个IDE。我选择VSCode,因为其中包含了所有必需的东西。我完成了Conda和Python的设置,但是当我使用C ++时,在编译task.json文件时遇到了问题。错误是找不到wchar.h。它可以在XCode和CLion上编译并正常工作,但是Clang在VSCode上不起作用。有关如何解决此问题的任何想法?

谢谢

HJ

这是错误代码供参考

# cell 1
from IPython.display import display

import random as rd
import numpy as np
import pandas as pd
import matplotlib.pylab as plt

# cell 2
class Output:
    """
    Helper class
    """
    def __init__(self, name='my-display'):
        self.h = display(display_id=name)
        self.content = ''
        self.mime_type = None
        self.dic_kind = {
            'text': 'text/plain',
            'markdown': 'text/markdown',
            'html': 'text/html',
        }

    def display(self):
        self.h.display({'text/plain': ''}, raw=True)

    def _build_obj(self, content, kind, append, new_line):
        self.mime_type = self.dic_kind.get(kind)
        if not self.mime_type:
            return content, False
        if append:
            sep = '\n' if new_line else ''
            self.content = self.content + sep + content
        else:
            self.content = content
        return {self.mime_type: self.content}, True

    def update(self, content, kind=None, append=False, new_line=True):
        obj, raw = self._build_obj(content, kind, append, new_line)
        self.h.update(obj, raw=raw)


# cell 3
out = Output(name='my-display-2')
out.display()
# ==> output is updated at each h.update() command in cells below

# cell 4
s = ''.join(rd.choices('abcedfghijklmn', k=5))
out.update(s, kind='text', append=False)

# cell 5
a, b = rd.choices(range(10), k=2)
s = f'''\
# Heading one {a}

This is a sample  {b}

* a
* list
'''
out.update(s, kind='markdown', append=True)

# cell 6
a, b = rd.choices(range(10), k=2)
s = f'''\
<h3>My Title {a}</h3>
<p>My paragraph {b}</p>
'''
out.update(s, kind='html')

# cell 7
a, b, c, d = rd.choices(range(10), k=4)
arr = np.array([[a,b,c,d], [d,c,b,a]])
out.update(arr)

# cell 8
a, b, c, d = rd.choices(range(10), k=4)
df = pd.DataFrame(data=[[a,b],[c,d]], columns=['A', 'B'])
out.update(df)

# cell 9
a, b, c, d = rd.choices(range(10), k=4)
df = pd.DataFrame(data=[[a,b],[c,d]], columns=['a', 'b'])
ax = df.plot();
fig = ax.get_figure()
out.update(fig)
plt.close()

# cell 10
fig, ax = plt.subplots()
a,b,c,d = rd.choices(range(10), k=4)
ax.plot([a,b,c,d]);
out.update(fig)
plt.close()

task.json文件:

In file included from /Users/kimh2/Desktop/Coding Stuff/C++/HelloWorld/main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:215:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:96:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/wchar.h:119:15: fatal error: 
      'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated.
The terminal process terminated with exit code: 1

0 个答案:

没有答案