Visual Studio 2017无法识别“系统”

编程入门 行业动态 更新时间:2024-10-11 03:17:14
本文介绍了Visual Studio 2017无法识别“系统”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近从Visual Studio 2015升级到Visual Studio 2017.当我打开我在2015年编写的程序时,系统和tolower被标记为未定义,我无法获得编译代码。

I recently upgraded from Visual Studio 2015 to Visual Studio 2017. When I opened a program that I had written in 2015, system and tolower were flagged as undefined and I could not get the code to compile.

#include< iostream> #include< cstdlib> #include< cctype> ; $ #include< vector> #include< iomanip> 使用命名空间std; #include" CashRegister.h" #include" Inventory.h" #include" CustomerDB.h" #include" Customer.h" #include" Report.h" #include" InventoryBook.h" const string INVENTORY_FILENAME =" inventory.dat"; void cashRegisterMenu(CashRegister& cr,Inventory& inv); void customerMenu(CustomerDB& cdb); void inventoryMenu(Inventory& inv); void reportMenu(Report& rep,Inventory& inv ,CustomerDB& cdb); $ void displayBookInfo(const InventoryBook * book); $ void displayCustomerInfo(Customer customer); InventoryBook makeBook(); InventoryBook editBook(const InventoryBook * book); Customer makeCustomer(); int main() { 字符选择; //浮动费用; CashRegister cr; 库存inv(INVENTORY_FILENAME); 报告代表; CustomerDB cdb; do { 系统(QUOT; CLS"); //未定期 cout<< "欢迎使用Serendipity书商POS软件系统" $ << endl<<结束; cout<< "选项:" << endl<<结束; cout<< "R - 收银机" <<结束; cout<< "我 - 库存" <<结束; cout<< "C - 客户" <<结束; cout<< "H - 报告" <<结束; cout<< "Q - 退出计划" << endl<<结束; cout<< "输入选项:"; $ choice = tolower(cin.get()); //未定期

#include <iostream> #include <cstdlib> #include <cctype> #include <vector> #include <iomanip> using namespace std; #include "CashRegister.h" #include "Inventory.h" #include "CustomerDB.h" #include "Customer.h" #include "Report.h" #include "InventoryBook.h" const string INVENTORY_FILENAME = "inventory.dat"; void cashRegisterMenu(CashRegister& cr, Inventory& inv); void customerMenu(CustomerDB& cdb); void inventoryMenu(Inventory& inv); void reportMenu(Report& rep, Inventory& inv, CustomerDB& cdb); void displayBookInfo(const InventoryBook* book); void displayCustomerInfo(Customer customer); InventoryBook makeBook(); InventoryBook editBook(const InventoryBook* book); Customer makeCustomer(); int main() { char choice; //float cost; CashRegister cr; Inventory inv(INVENTORY_FILENAME); Report rep; CustomerDB cdb; do { system("CLS"); // UNDEFINED cout << "Welcome to the Serendipity Booksellers POS Software System" << endl << endl; cout << "Options:" << endl << endl; cout << "R - Cash Register" << endl; cout << "I - Inventory" << endl; cout << "C - Customer" << endl; cout << "H - Report" << endl; cout << "Q - Quit Program" << endl << endl; cout << "Enter option: "; choice = tolower(cin.get()); // UNDEFINED

我最终创建了一个新项目并搬家所有文件都进入了新项目。当我这样做时,一切都在新项目中起作用,但所有代码都完全相同。我真的不想为2017年之前在VS的某个版本中编写的每个程序执行此操作。任何人都对可能发生的事情有任何想法,如何在不创建新的情况下纠正它项目和复制文件?

I ended up creating a new project and moving all the files into the new project. When I did this, everything worked in the new project but all the code is exactly the same. I really do not want to have to do this for every program I had written in some version of VS prior to 2017. Any one have any ideas of what might have happened and how I could have corrected it without creating a new project and copying the files over?

推荐答案

system 函数需要< ;文件stdlib.h>或< process.h>头。尝试在旧项目中添加 '#include< stdlib.h>'。

The system function requires the <stdlib.h> or <process.h> header. Try adding ‘#include <stdlib.h>’ in your old project.

也许在新项目中,标题是在"stdafx.h"文件中指定的,这是适合这类事情的地方。

更多推荐

Visual Studio 2017无法识别“系统”

本文发布于:2023-11-25 09:29:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629222.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法识别   系统   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!