编译日志会让任何人知道这个错误是如何弹出的
Compile log does anyone knwo how this error can pop up?
我不知道是如何或为什么,谷歌也没有真正的帮助,,,但有人能告诉我们为什么会出现这个错误,以及如何修复它吗?我想尽一切办法。。。。我没主意了。
错误部分:
**** Build of configuration Debug for project Lab3-5Mod ****
**** Internal Builder is used for build
**** g++ -ID:c++BeginLab3-5Mod -O0 -g3 -Wall -c -fmessage-length=0 -o srcUI.o..srcUI.cpp
..srcUI.cpp: In function 'int printMenu()':
..srcUI.cpp:39:15: error: expected primary-expression before 'int'
..srcUI.cpp:39:24: error: expected primary-expression before 'int'
..srcUI.cpp:39:39: error: expected primary-expression before 'M'
..srcUI.cpp: In function 'int main()':
..srcUI.cpp:75:18: error: expected primary-expression before 'M'
Build error occurred, build is stopped
Time consumed: 370 ms.
代码:
#include <iostream>
#include "Structs.h"
#include "structs.cpp"
#include "controller.cpp"
#include "UI.h"
using namespace std;
int printMenu(){
int input;
input = 1;
while (input){
cout<<"1. Add to current day "<<endl;
cout<<"2. Insert amount to day by type "<<endl;
cout<<"3. Remove day "<<endl;
cout<<"4. Remove days "<<endl;
cout<<"5. Remove type of expenses"<<endl;
cout<<"6. Replace type at specified day"<<endl;
cout<<"7. Show expenses bigger than"<<endl;
cout<<"8. Show expenses bigger than... to day..."<<endl;
cout<<"9. Show expenses of specified type overall"<<endl;
cout<<"10. Calculate sum of specified type over all"<<endl;
cout<<"11. Show day with highest expenses"<<endl;
cout<<"12. Show all days with specified expenses"<<endl;
cout<<"13. Sort days by expenses increasing"<<endl;
cout<<"14. Sort days by expenses discreasing"<<endl;
cout<<"15. Filter type"<<endl;
cout<<"16. Filter type starting with"<<endl;
cout<<"---------------------------------------------"<<endl;
cout<<"18. Undo"<<endl;
cout<<"0. Clear and exit!"<<endl;
cout<<"enter option: ";
cin>>input;
switch(input){
case 1:add(int cant,int tip, Array M);
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 0:break;
default: cout<<"Wrong input!"<<endl;break;
}
}
return 0;
}
int main()
{
//Main function of the program. no pre/ post condition.
Array M;
constr(M);
Array B;
constr(B);
dummyData(Array M);
printMenu();
return 0;
}
数组头:
struct Array{
int days;
int exp;
int **M;
};
void constr(Array &);
void destruc(Array &);
void add(int, int, Array &);
控制器添加功能:
void add(int cant,int tip, Array M){
//Adds to current day the amount to a specific type
currDay();
M.M[currentDay][tip] += cant;
}
您不会调用这样的函数:
add(int cant,int tip, Array M);
您无需指定数据类型:
add(cant,tip, M);
也在此处:dummyData(Array M);
->dummyData(M);
只能在声明中指定数据类型,而不能在调用函数时指定。
case 1:add(int cant,int tip, Array M);
当您调用add时,您不会指定实际参数的类型。
相关文章:
- 多个文件的内存分配错误"在抛出 'std :: bad_alloc' what (): std :: bad_alloc 的实例后终止调用" [C++]
- SDL 窗口不会弹出
- Xaudio2在更改缓冲区或循环时弹出声音
- 我收到以下错误:抛出'std::bad_alloc'实例后终止调用
- 如何使用结构和指针推动和弹出一堆双打
- C++ 尝试生成随机数时弹出警告帮助?
- C++泛型类错误,问题出在哪里?
- 我无法在某个点(从用户那里)获得输入,即使没有错误弹出编译
- 为什么当我尝试将priority_queue与参数一起使用作为指向结构的指针时会弹出错误
- 从priority_queue弹出时出现排序问题,这是 std::p riority_queue 的错误吗?
- C++,弹出调试断言失败窗口,我得到矢量迭代器不兼容的错误运行时
- 当我编译引用 std::ostream 时,我有一个奇怪的错误弹出
- 了解从队列弹出时引用中的分段错误
- 尝试打印 a[1] 的地址时错误:弹出一元'&'操作数时需要左值
- 禁用Visual Studio中的错误弹出窗口
- 编译日志会让任何人知道这个错误是如何弹出的
- 我的C++程序可以运行,但总是弹出错误
- 当我弹出时,我收到"pointer being freed was not allocated"错误
- C++STL堆栈弹出操作导致分段错误
- 随机数生成器为c++弹出一个错误