运行CLion C ++示例程序时出错

时间:2016-07-25 02:32:59

标签: c++ clion

我刚刚和minGW一起下载了CLion,并创建了一个项目。经过大量的努力后,我设法获得了运行示例Hello World程序的按钮。但是,当我尝试运行该程序时,它会在向我提供此错误日志之前将其编译为50%:https://justpaste.it/wm14

非常长,大约450行。我不知道为什么我会收到这个错误...任何帮助将不胜感激! :)

错误的前几行如下。在错误列表中有一个类似于此的重复模式,开始In file included from后跟一个错误列表,例如has not been declared usingis not a member of 'std'does not name a type

In file included from c:\mingw\include\wchar.h:208:0,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
from C:\Users\Ole\Documents\programming\c++\testing\main.cpp:1:
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:\mingw\include\sys/stat.h:173:14: error: '_mode_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^

以下是代码:

#include "iostream"

int main () {
  std::cout << "Hello World!" << std::endl;
  return 0;
}

我设法将问题与include语句隔离开来。如果我删除include(和cout),它构建正常,但如果我添加include(而不是cout)它会给我同样的错误。

更新

我设法通过简单地删除minGW并安装cygwin来解决此问题。

1 个答案:

答案 0 :(得分:1)

尝试使用

InputAccessoryView

而不是

//Add done button to numeric pad keyboard
 let toolbarDone = UIToolbar.init()
 toolbarDone.sizeToFit()
 let barBtnDone = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.Done,
         target: self, action: #selector(VerifyCardViewController.doneButton_Clicked(_:)))

 toolbarDone.items = [barBtnDone] // You can even add cancel button too
 txtCardDetails3.inputAccessoryView = toolbarDone
  • 就像Richard C建议的那样,我也猜测它是一个搜索路径问题。