C++ Visual Studio 2017未识别“未识别”;系统“;

C++ Visual Studio 2017未识别“未识别”;系统“;,c++,visual-studio-2017,C++,Visual Studio 2017,我最近从Visual Studio 2015升级到Visual Studio 2017。当我打开2015年编写的程序时,system和tolower被标记为未定义,我无法编译代码 #include <iostream> #include <cstdlib> #include <cctype> #include <vector> #include <iomanip> using namespace std; #include "Cash

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

#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
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
#包括“cash register.h”
#包括“Inventory.h”
#包括“CustomerDB.h”
#包括“Customer.h”
#包括“Report.h”
#包括“InventoryBook.h”
const string INVENTORY\u FILENAME=“INVENTORY.dat”;
作废现金登记簿菜单(现金登记簿和cr、存货和存货);
作废客户菜单(客户数据库和cdb);
作废库存菜单(库存和库存);
作废报告菜单(报告和报告、库存和库存、客户数据库和cdb);
void displayBookInfo(const InventoryBook*book);
无效显示CustomerInfo(客户);
InventoryBook makeBook();
目录书编辑本(常数目录书*目录);
客户makeCustomer();
int main()
{
字符选择;
//浮动成本;
收银机;
库存库存(库存文件名);
报告代表;
客户开发银行;
做
{
系统(“CLS”);//未定义

无法修剪
main
,因为它只有
系统(“CLS”)
然后构建。如果它仍然有问题,请修剪除
#include
之外的所有头文件。如果它仍然有问题,发布将非常好。如果它没有问题,您可以继续添加内容,直到它有问题。然后,您可以发布。简单回答,不要使用
系统()
-这样做几乎没有什么好的理由,而且不可避免地会使您的代码无法移植。无论您的问题是什么原因,我都为VS2017为您提供了重新思考使用
系统()的理由而喝彩
。它不应该被使用。功能不好;你没有cookie。@尼尔·巴特沃斯(Neil Butterworth)更不用说所有潜在的安全问题了……是的,IDE将它们标记为未定义(带有红色曲线)。对于所有说不使用系统的人来说,这并不能真正回答问题。你可能已经注意到,它也在标记tolower()由于未定义,我是否也应该使用它。此外,您可能希望停止鼓掌,因为VS2017仍然允许您使用system()正如我在最初的帖子中所说,我能够将代码复制到一个新的项目中,并且一切正常。我只是想弄清楚是什么原因导致它不能在原来的项目中工作。Trim
main
to只有
系统(“CLS”)
然后构建。如果它仍然有问题,请修剪除
#include
之外的所有头文件。如果它仍然有问题,发布将非常好。如果它没有问题,您可以继续添加内容,直到它有问题。然后,您可以发布。简单回答,不要使用
系统()
-这样做几乎没有什么好的理由,而且不可避免地会使您的代码无法移植。无论您的问题是什么原因,我都为VS2017为您提供了重新思考使用
系统()的理由而喝彩
。它不应该被使用。功能不好;你没有cookie。@尼尔·巴特沃斯(Neil Butterworth)更不用说所有潜在的安全问题了……是的,IDE将它们标记为未定义(带有红色曲线)。对于所有说不使用系统的人来说,这并不能真正回答问题。你可能已经注意到,它也在标记tolower()作为未定义的,我不应该也使用它。另外,你可能想停止鼓掌,因为VS2017仍然允许你使用system(),正如我在最初的帖子中所说,我能够将代码复制到一个新的项目中,并且一切都正常。我只是想弄清楚是什么原因导致它在最初的项目中不工作。