小编Wat*_*hul的帖子

我不明白尝试将字符串用作函数参数时遇到的错误

    #ifndef MENU_H
    #define MENU_H
    #include <cstring>
    #include <string>
    #include <cctype>
    class Menu{
    public:
    Menu();
    void run();
    int selectOptions();
    void rotate90();
    void rotate180();
    void rotate270();
    void flipVert();
    void flipHoriz();
    void convertHigh(int threshold);
    void saveImage(string saveName);
    void loadImage(string loadName);
    void displayMenu();
    private:
    }
    #endif // MENU_H
Run Code Online (Sandbox Code Playgroud)
C:\Users\Wattenphul\Documents\alg-prog design\project04>g++ -std=c++11 -o main.exe main.cpp menu.cpp

In file included from menu.cpp:6:

menu.h:22:20: error: 'string' has not been declared

     void saveImage(string saveName);

                    ^~~~~~

menu.h:22:35: error: expected ',' or '...' before 'saveName'

     void saveImage(string saveName);

                                   ^~~~~~~~

menu.h:23:20: …
Run Code Online (Sandbox Code Playgroud)

c++ string compiler-errors g++

2
推荐指数
1
解决办法
38
查看次数

标签 统计

c++ ×1

compiler-errors ×1

g++ ×1

string ×1