1.error: can not open precompiled header file:Debug/.pch:No such file 或VS在查找预编译头使用时跳过解决
可以设置Project properties,在c/c++栏,选择PreCompiled headers,然后设置第一选项,选择不使用预编译头,解决这个问题
2.一个solution里存在有多个project的时候,编译成功,但是会提示unable to start program:原因可能有多种,这里提供一种可能的解决方法,右键sln-》property,在single startup project选择需要启动的工程。
3.C语言生成的EXE程序怎么取消运行后自动关闭
在程序末尾加个死循环或者加个读入数据, while(1);//就是在这里加,也可以加getch(),getchar(),for(;;)
改程序,在最后退出程序前加一句 system("pause");system("pause")在编写C时包含在"stdlib.h"头文件中
4.出现如下错误“#("The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name:")”
项目-项目属性-C/++-预处理器定义-编辑,然后在定义框中输入“_CRT_NONSTDC_NO_DEPRECATE” 和“ _CRT_SECURE_NO_WARNINGS”
5.出现the function maybe unsafe,consider using ** instead,解决办法:在项目属性预处理器定义添加一句命令“_CRT_SECURE_NO_WARNINGS”
6.创建文件夹命令
using std ::string;
#include "windows.h"
string dirName = "C:/Users/hnf_YF/Desktop/testsys";
bool flag = CreateDirectory(dirName.c_str(), NULL);
CreateDirectory()函数参数如果提示"Error: "const char"类型的实参与"LPCWSTR"类型的形参不兼容",解决方法:项目菜单——项目属性(最后一个)——配置属性——常规——项目默认值——字符集,将使用Unicode字符集改为未设置即可。
LP:指针
C:const
W:wide宽字符
STR表示这个变量是一个字符串
详细可参考:https://blog.csdn.net/gaoyang610/article/details/21234979