Error default argument given for parameter 3 of

  • Forum
  • Beginners
  • error: default argument given for param

error: default argument given for parameter 1,2 and 3 of’int volume

This code is giving error: Default argument given for parameter 1,2 and 3 of’int volume’.
what is the possible problem with the code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 #include<iostream>
#include<iomanip>
using namespace std;
int volume(int L=1, int w=1,int h=1);
void funcone(int& x,double y=12.34,char z='b');
int main()
{
    int a=23;
    double b=48.78;
    char ch='M';
    cout<<fixed<<showpoint<<setprecision(2);
    cout<<"a="<<a<<" b="<<b<<" ch="<<ch<<endl;
    cout<<"volume="<<volume()<<endl;
    cout<<"volume="<<volume(5,4)<<endl;
    cout<<"volume="<<volume(34)<<endl;
    cout<<"volume="<<volume(6,4,5)<<endl;
    funcone(a);
    funcone(a,42.68);
    funcone(a,34.65,'Q');
    cout<<"a="<<a<<" b="<<b<<" ch="<<ch<<endl;
    return 0;
}
    int volume(int L=1,int w=1,int h=1)
    {
        return L*w*h;
    }
    void funcone(int& x, double y,char z)
    {
        x=2*x;
        cout<<"x="<<x<<" y="<<y<<" z="<<z<<endl;
    }

You can’t re-declare default arguments twice in the same scope. In practice, this means that default arguments (usually) appear only at the first declaration of the function.

1
2
3
4
int volume(int l=1, int w=1,int h=1);
// ...
int volume(int l, int w, int h) 
{ return l * w * h; }

The details are here:
http://en.cppreference.com/w/cpp/language/default_arguments

Topic archived. No new replies allowed.

Для меня это очень простая задача, и я не уверен, почему это создает мне проблемы. Я просто заставляю два класса-макета пытаться компилировать без какой-либо логики в своих методах с использованием уже предоставленных мне заголовков и объявлений. Честно говоря, это всего лишь работа по вырезке и вставке, и все же я все еще сталкивался с этим золотым самородком любви —

cbutton.cpp:11:44: error: default argument given for parameter 4 of ‘cio::CButton::CButton(const char*, int, int, bool, const char*)’ [-fpermissive]
cbutton.h:7:5: error: after previous specification in ‘cio::CButton::CButton(const char*, int, int, bool, const char*)’ [-fpermissive]
cbutton.cpp:11:44: error: default argument given for parameter 5 of ‘cio::CButton::CButton(const char*, int, int, bool, const char*)’ [-fpermissive]
cbutton.h:7:5: error: after previous specification in ‘cio::CButton::CButton(const char*, int, int, bool, const char*)’ [-fpermissive]
cbutton.cpp:19:41: error: default argument given for parameter 1 of ‘void cio::CButton::draw(int)’ [-fpermissive]
cbutton.h:11:10: error: after previous specification in ‘virtual void cio::CButton::draw(int)’ [-fpermissive]
cbutton.cpp:53:29: error: ‘virtual’ outside class declaration

Вот файлы, с которыми я работаю. Всем спасибо, как всегда!

#include "cfield.h"
namespace cio{
class  CButton: public CField{

public:
CButton(const char *Str, int Row, int Col,
bool Bordered = true,
const char* Border=C_BORDER_CHARS);
virtual ~CButton();
void draw(int rn=C_FULL_FRAME);
int edit();
bool editable()const;
void set(const void* str);
};
}#include "cbutton.h"
namespace cio {

CButton::CButton(const char *Str, int Row, int Col,
bool Bordered = true,
const char* Border=C_BORDER_CHARS){

}

void CButton::draw(int rn=C_FULL_FRAME){

}

int CButton::edit(){

return 0;
}

bool CButton::editable()const {

return false;
}

void CButton::set(const void* str){

}

virtual CButton::~CButton(){

}
}

2

Решение

Вы указали аргумент по умолчанию в определении функции, в то время как они уже имели аргумент по умолчанию в объявлении класса. Вы можете объявить аргументы по умолчанию в объявлении класса или в определении функции, но не в обоих.

РЕДАКТИРОВАТЬ: Пропустил конец ваших ошибок: error: ‘virtual’ outside class declaration, Это довольно очевидная ошибка компилятора: virtual ключевые слова принадлежат объявлениям классов, а не определениям функций. Просто удалите его из определения вашего деструктора.

Исправленный источник:

namespace cio {

CButton::CButton(const char *Str, int Row, int Col,
bool Bordered, // No default parameter here,
const char* Border){ // here,

}

void CButton::draw(int rn){ // and here

}

CButton::~CButton(){ // No virtual keyword here

}
}

12

Другие решения

Вы не включаете параметр по умолчанию в определение своей функции, прототип — единственный, в который нужно включить значение по умолчанию.

#include "cbutton.h"
namespace cio {

CButton::CButton(const char *Str, int Row, int Col,
bool Bordered,
const char* Border){ //remove in def

}

void CButton::draw(int rn){

}

1

Вы не можете повторять аргументы по умолчанию при определении функции. Они принадлежат только на декларации. (Действительное правило не так просто, потому что определение также может быть определением, но вы поняли …)

0

ACTIONFENIX

3 / 3 / 2

Регистрация: 21.02.2015

Сообщений: 77

1

07.02.2017, 13:21. Показов 2811. Ответов 1

Метки нет (Все метки)


Не могу понять, почему выдает эту странную ошибку:
C:UsersMishaDocumentsLabamywidget.cpp:35: ошибка: default argument given for parameter 2 of ‘MyWidget::MyWidget(QString, QWidget*)’ [-fpermissive]
MyWidget::MyWidget(const QString pass, QWidget *parent = 0): password(pass), QWidget(parent)
^
в функции:

C++ (Qt)
1
2
3
4
MyWidget::MyWidget(const QString pass, QWidget *parent = 0): password(pass), QWidget(parent)
{
 
}

весь код прилагается:

C++ (Qt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef MYWIDGET_H
#define MYWIDGET_H
 
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QString>
 
class MyWidget : public QWidget
{
    Q_OBJECT
public:
    explicit MyWidget(QWidget *parent = 0);
    MyWidget(const QString pass, QWidget *parent = 0);
    void SetPassword(const QString new_password);
    ~MyWidget();
signals:
 
public slots:
 
private:
    QString password;
    QLabel *label_login;
    QLabel *label_pass;
    QPushButton *button_OK;
    QPushButton *button_CANCEL;
    QLineEdit *lineedit_login;
    QLineEdit *lineedit_pass;
    QHBoxLayout *line_login;
    QHBoxLayout *line_pass;
    QHBoxLayout *line_buttons;
    QVBoxLayout *main_layout;
};
 
#endif // MYWIDGET_H
C++ (Qt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "mywidget.h"
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QVBoxLayout>
 
MyWidget::MyWidget(QWidget *parent) : QWidget(parent)
{
    password = "password";
    label_login = new QLabel("Line Edit 1");
    label_pass = new QLabel("Line Edit 2");
    button_OK = new QPushButton("&OK");
    button_CANCEL = new QPushButton("&CANCEL");
    lineedit_login = new QLineEdit("Text 1");
    lineedit_pass = new QLineEdit("Text 2");
    line_login = new QHBoxLayout;
    line_login->addWidget(label_login);
    line_login->addWidget(lineedit_login);
    line_pass = new QHBoxLayout;
    line_pass->addWidget(label_pass);
    line_pass->addWidget(lineedit_pass);
    line_buttons = new QHBoxLayout;
    line_buttons->addWidget(button_OK);
    line_buttons->addStretch();
    line_buttons->addWidget(button_CANCEL);
    main_layout = new QVBoxLayout;
    main_layout->addLayout(line_login);
    main_layout->addLayout(line_pass);
    main_layout->addLayout(line_buttons);
    setLayout(main_layout);
    connect(button_CANCEL, SIGNAL(clicked(bool)), this, SLOT(close()));
}
 
MyWidget::MyWidget(const QString pass, QWidget *parent = 0): password(pass), QWidget(parent)
{
 
}
 
void MyWidget::SetPassword(const QString new_password)
{
    password = new_password;
}
 
MyWidget::~MyWidget()
{
    delete label_login;
    delete label_pass;
    delete button_OK;
    delete button_CANCEL;
    delete line_login;
    delete line_pass;
    delete line_login;
    delete line_pass;
    delete line_buttons;
    delete main_layout;
}
C++ (Qt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <QApplication>
#include <QLabel>
#include <QPushButton>
#include <QFont>
#include "mywidget.h"
 
int main(int lol, char *kek[])
{
    QApplication chebureck(lol, kek);
    MyWidget wgt;
    wgt.SetPassword("KEK");
    wgt.show();
    return chebureck.exec();
}

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Горбаг

184 / 176 / 57

Регистрация: 25.09.2014

Сообщений: 828

07.02.2017, 13:33

2

Лучший ответ Сообщение было отмечено Wyn как решение

Решение

Во втором конструкторе у тебя так в cpp:

C++ (Qt)
1
MyWidget::MyWidget(const QString pass, QWidget *parent = 0): password(pass), QWidget(parent)

а должно быть так:

C++ (Qt)
1
MyWidget::MyWidget(const QString pass, QWidget *parent): password(pass), QWidget(parent)

Добавлено через 2 минуты
И если уж ты наследуешься от QWidget, да и вообще от какого-либо класса, очень тебя прошу, предоставляй полные конструкторы наследования. Очень, знаешь ли, неудобно пользоваться виджетом, знать, что он является наследником класса QWidget, а получить облом при вызове MyWidget(parent, flags)…



1



New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

qwewer0 opened this issue

Jan 27, 2020

· 76 comments


Closed

[BUG] Can’t compile Marlin 2.0.2

#16691

qwewer0 opened this issue

Jan 27, 2020

· 76 comments

Comments

@qwewer0

Configuration.zip

VS Code terminal output

In file included from Marlinsrcmodule/stepper.h:47:0,
                 from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:701:0: warning: "enable_Z" redefined
 #define  enable_Z() do{ Z_enable();  Z2_enable();  Z3_enable();  Z4_enable(); }while(0)

In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:142:0: note: this is the location of the previous definition
 #define  enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)

In file included from Marlinsrcmodule/stepper.h:47:0,
                 from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:702:0: warning: "disable_Z" redefined
 #define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); Z4_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
 
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:143:0: note: this is the location of the previous definition
 #define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from Marlinsrclcd/ultralcd.h:40:0,
                 from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:47:61: error: default argument given for parameter 1 of 'void manage_inactivity(bool)' [-fpermissive]
 void manage_inactivity(const bool ignore_stepper_queue=false);
                                                             ^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:47:6: note: previous specification in 'void manage_inactivity(bool)' here
 void manage_inactivity(const bool ignore_stepper_queue=false);
      ^~~~~~~~~~~~~~~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
                 from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 1 of 'void kill(const char*, const char*, bool)' [-fpermissive]
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
                                                                                                          ^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in 'void kill(const char*, const char*, bool)' here
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
      ^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
                 from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 2 of 'void kill(const char*, const char*, bool)' [-fpermissive]
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
                                                                                                          ^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in 'void kill(const char*, const char*, bool)' here
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
      ^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
                 from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 3 of 'void kill(const char*, const char*, bool)' [-fpermissive]
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
                                                                                                          ^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in 'void kill(const char*, const char*, bool)' here
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
      ^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
                 from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:69:43: error: default argument given for parameter 1 of 'void minkill(bool)' [-fpermissive]
 void minkill(const bool steppers_off=false);
                                           ^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:326:6: note: previous specification in 'void minkill(bool)' here
 void minkill(const bool steppers_off=false);
      ^~~~~~~
compilation terminated due to -fmax-errors=5.
*** [.piobuildSTM32F103RC_bigtree_512KsrcsrcMarlin.cpp.o] Error 1

@qwewer0



Copy link


Contributor

Author

PlatformIO in MarlinCore.h underscores the «false» in these:

(47) — void manage_inactivity(const bool ignore_stepper_queue=false);

(68) — void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);

(69) — void minkill(const bool steppers_off=false);

@qwewer0



Copy link


Contributor

Author

Unable to compile Bugfix-2.0.x with this terminal output:

Marlinsrcgcodegcode.cpp: In static member function 'static void GcodeSuite::process_parsed_command(bool)':
Marlinsrcgcodegcode.cpp:335:16: error: 'G60' was not declared in this scope
       case 60: G60(); break;                                      // G60:  save current position
                ^~~
Marlinsrcgcodegcode.cpp:335:16: note: suggested alternative: 'G10'
       case 60: G60(); break;                                      // G60:  save current position
                ^~~
                G10
Marlinsrcgcodegcode.cpp:336:16: error: 'G61' was not declared in this scope
       case 61: G61(); break;                                      // G61:  Apply/restore saved coordinates.
                ^~~
Marlinsrcgcodegcode.cpp:336:16: note: suggested alternative: 'G11'
       case 61: G61(); break;                                      // G61:  Apply/restore saved coordinates.
                ^~~
                G11
*** [.piobuildSTM32F103RC_bigtree_512Ksrcsrcgcodegcode.cpp.o] Error 1

@tpruvot

@qwewer0



Copy link


Contributor

Author

By commenting out lines 335 and 336 in gcode.cpp I was able to compile Bugfix-2.0.x. The problem with 2.0.2 is still remain.

@Talha909

Can’t compile Marlin 2.0.2

VS Code terminal output
«`
Compiling .piobuildLPC1769srcsrccoreutility.cpp.o
In file included from Marlinsrcmodule/stepper.h:47,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:701: warning: «enable_Z» redefined
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); Z4_enable(); }while(0)

In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:142: note: this is the location of the previous definition
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)

In file included from Marlinsrcmodule/stepper.h:47,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:702: warning: «disable_Z» redefined
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); Z4_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:143: note: this is the location of the previous definition
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

Compiling .piobuildLPC1769srcsrcfeatureI2CPositionEncoder.cpp.o
Compiling .piobuildLPC1769srcsrcfeatureMax7219_Debug_LEDs.cpp.o
Compiling .piobuildLPC1769srcsrcfeaturebabystep.cpp.o
Compiling .piobuildLPC1769srcsrcfeaturebacklash.cpp.o
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:47:61: error: default argument given for parameter 1 of ‘void manage_inactivity(bool)’ [-fpermissive]
void manage_inactivity(const bool ignore_stepper_queue=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:47:6: note: previous specification in ‘void manage_inactivity(bool)’ here
void manage_inactivity(const bool ignore_stepper_queue=false);
^~~~~~~~~~~~~~~~~
Compiling .piobuildLPC1769srcsrcfeaturebaricuda.cpp.o
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 1 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 2 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 3 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:69:43: error: default argument given for parameter 1 of ‘void minkill(bool)’ [-fpermissive]
void minkill(const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:326:6: note: previous specification in ‘void minkill(bool)’ here
void minkill(const bool steppers_off=false);
^~~~~~~
compilation terminated due to -fmax-errors=5.
*** [.piobuildLPC1769srcsrcMarlin.cpp.o] Error 1
============================================================ [FAILED] Took 13.33 seconds ============================================================

Environment Status Duration


megaatmega2560 IGNORED
megaatmega1280 IGNORED
rambo IGNORED
FYSETC_F6_13 IGNORED
FYSETC_F6_14 IGNORED
sanguino_atmega644p IGNORED
sanguino_atmega1284p IGNORED
melzi IGNORED
melzi_optiboot IGNORED
at90usb1286_cdc IGNORED
at90usb1286_dfu IGNORED
DUE IGNORED
DUE_USB IGNORED
DUE_debug IGNORED
LPC1768 IGNORED
LPC1769 FAILED 00:00:13.333

@ellensp

even with zero changes it fails to compile..
Issue is it has marlin.h, marlin.cpp and marlincore.h, marlincore.cpp… cant have both sets
Then you get the G60/G61 errors also…

@Calimerorulez

Same here:

VS Code terminal output
«`
Compiling .pio/build/STM32F103RC_bigtree/src/src/core/utility.cpp.o
In file included from Marlin/src/module/stepper.h:47:0,
from Marlin/src/Marlin.cpp:37:
Marlin/src/module/stepper/indirection.h:701:0: warning: «enable_Z» redefined
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); Z4_enable(); }while(0)

In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:142:0: note: this is the location of the previous definition
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)

In file included from Marlin/src/module/stepper.h:47:0,
from Marlin/src/Marlin.cpp:37:
Marlin/src/module/stepper/indirection.h:702:0: warning: «disable_Z» redefined
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); Z4_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:143:0: note: this is the location of the previous definition
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from Marlin/src/lcd/ultralcd.h:40:0,
from Marlin/src/Marlin.cpp:34:
Marlin/src/lcd/../MarlinCore.h:45:1: error: default argument given for parameter 1 of ‘void idle(bool)’ [-fpermissive]
);
^
In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:41:6: note: previous specification in ‘void idle(bool)’ here
void idle(
^~~~
In file included from Marlin/src/lcd/ultralcd.h:40:0,
from Marlin/src/Marlin.cpp:34:
Marlin/src/lcd/../MarlinCore.h:47:61: error: default argument given for parameter 1 of ‘void manage_inactivity(bool)’ [-fpermissive]
void manage_inactivity(const bool ignore_stepper_queue=false);
^
In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:47:6: note: previous specification in ‘void manage_inactivity(bool)’ here
void manage_inactivity(const bool ignore_stepper_queue=false);
^~~~~~~~~~~~~~~~~
In file included from Marlin/src/lcd/ultralcd.h:40:0,
from Marlin/src/Marlin.cpp:34:
Marlin/src/lcd/../MarlinCore.h:68:106: error: default argument given for parameter 1 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlin/src/lcd/ultralcd.h:40:0,
from Marlin/src/Marlin.cpp:34:
Marlin/src/lcd/../MarlinCore.h:68:106: error: default argument given for parameter 2 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlin/src/lcd/ultralcd.h:40:0,
from Marlin/src/Marlin.cpp:34:
Marlin/src/lcd/../MarlinCore.h:68:106: error: default argument given for parameter 3 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from Marlin/src/Marlin.cpp:31:0:
Marlin/src/Marlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
compilation terminated due to -fmax-errors=5.
*** [.pio/build/STM32F103RC_bigtree/src/src/Marlin.cpp.o] Error 1
=============================================================== [FAILED] Took 190.07 seconds ===============================================================

Environment Status Duration


megaatmega2560 IGNORED
megaatmega1280 IGNORED
rambo IGNORED
FYSETC_F6_13 IGNORED
FYSETC_F6_14 IGNORED
sanguino_atmega644p IGNORED
sanguino_atmega1284p IGNORED
melzi IGNORED
melzi_optiboot IGNORED
at90usb1286_cdc IGNORED
at90usb1286_dfu IGNORED
DUE IGNORED
DUE_USB IGNORED
DUE_debug IGNORED
LPC1768 IGNORED
LPC1769 IGNORED
STM32F103RC IGNORED
STM32F103RC_fysetc IGNORED
STM32F103RC_bigtree FAILED 00:03:10.074
STM32F103RC_bigtree_USB IGNORED
STM32F103RC_bigtree_512K IGNORED
STM32F103RC_bigtree_512K_USB IGNORED
STM32F103RE IGNORED
STM32F103RE_bigtree IGNORED
STM32F103RE_bigtree_USB IGNORED
STM32F4 IGNORED
STM32F7 IGNORED
ARMED IGNORED
STM32F103VE_GTM32 IGNORED
STM32F103VE_longer IGNORED
mks_robin_mini IGNORED
mks_robin_nano IGNORED
mks_robin IGNORED
mks_robin_pro IGNORED
mks_robin_lite IGNORED
mks_robin_lite3 IGNORED
jgaurora_a5s_a1 IGNORED
STM32F103CB_malyan IGNORED
chitu_f103 IGNORED
STM32F401VE_STEVAL IGNORED
FLYF407ZG IGNORED
FYSETC_S6 IGNORED
STM32F407VE_black IGNORED
BIGTREE_SKR_PRO IGNORED
BIGTREE_GTR_V1_0 IGNORED
BIGTREE_BTT002 IGNORED
teensy31 IGNORED
teensy35 IGNORED
esp32 IGNORED
linux_native IGNORED
SAMD51_grandcentral_m4 IGNORED
rumba32_f446ve IGNORED
mks_rumba32 IGNORED
include_tree IGNORED
========================================================== 1 failed, 0 succeeded in 00:03:10.074 ==========================================================
#define STRING_DISTRIBUTION_DATE «2020-01-27»

@DerAndere1

Can you compile after deleting files Marlin/src/Marlin.h and Marlin/src/Marlin.cpp ?

@qwewer0



Copy link


Contributor

Author

Can you compile after deleting files src/Marlin.h and src/Marlin.cpp ?

What files exactly?

@Talha909

Magic Works. Whats the reason behind this . I deleted two files and after that compile the firmware. And its successful

@DerAndere1

If you use Marlin 2.0.2 release, downloaded before commit ec79034 and you cannot simply update to latest bugfix-2.0.x (wich was fixed with commit 8bd6b60), I can confirm that 2.0.2 relase compiles if you delete files Marlin/src/Marlin.h and Marlin/src/Marlin.cpp and also delete lines 335 and 336 in file Marlin/src/gcode/gcode.cpp

@Hesi-Re

Deleting lines 335 and 336 in file Marlin/src/gcode/gcode.cpp and also deleting files Marlin/src/Marlin.h and Marlin/src/Marlin.cpp doesn’t solve the problem. I cannot compile with VSCode:

Marlin/src/_Marlin.cpp:31:10: fatal error: Marlin.h: No such file or directory

@Lord-Quake

Did you really delete the files?

@spooky79

I also have a compilation problem , skr e3 mini
marlin problem

@Scope666

Same error as @spooky79 (SKR Mini E3 v1.2)

EDIT: It does compile with changes suggested by DerAndere1 … just not sure if that will break anything functionality wise?

VS Code terminal output
«`
In file included from Marlinsrcmodule/stepper.h:47:0,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:701:0: warning: «enable_Z» redefined
Compiling .piobuildSTM32F103RC_bigtree_512K_USBsrcsrcfeaturebacklash.cpp.o
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); Z4_enable(); }while(0)

In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:142:0: note: this is the location of the previous definition
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)

In file included from Marlinsrcmodule/stepper.h:47:0,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:702:0: warning: «disable_Z» redefined
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); Z4_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:143:0: note: this is the location of the previous definition
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:45:1: error: default argument given for parameter 1 of ‘void idle(bool)’ [-fpermissive]
);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:41:6: note: previous specification in ‘void idle(bool)’ here
void idle(
^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:47:61: error: default argument given for parameter 1 of ‘void manage_inactivity(bool)’ [-fpermissive]
void manage_inactivity(const bool ignore_stepper_queue=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:47:6: note: previous specification in ‘void manage_inactivity(bool)’ here
void manage_inactivity(const bool ignore_stepper_queue=false);
^~~~~~~~~~~~~~~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 1 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 2 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 3 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
compilation terminated due to -fmax-errors=5.
*** [.piobuildSTM32F103RC_bigtree_512K_USBsrcsrcMarlin.cpp.o] Error 1

@Hesi-Re

Did you really delete the files?

I confirm deleting those files solves the problem. Before I just changed files name.

@Hesi-Re

I get also this compile error:

Marlin/src/feature/pause.cpp: In function 'bool unload_filament(const float&, bool, PauseMode)':
Marlin/src/feature/pause.cpp:355:20: error: 'FILAMENT_UNLOAD_PURGE_FEEDRATE' was not declared in this scope
                   (FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marlin/src/feature/pause.cpp:355:20: note: suggested alternative: 'FILAMENT_UNLOAD_PURGE_RETRACT'
                   (FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    FILAMENT_UNLOAD_PURGE_RETRACT

@Scope666

I get also this compile error:

Marlin/src/feature/pause.cpp: In function ‘bool unload_filament(const float&, bool, PauseMode)’:
Marlin/src/feature/pause.cpp:355:20: error: ‘FILAMENT_UNLOAD_PURGE_FEEDRATE’ was not declared in this scope
(FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marlin/src/feature/pause.cpp:355:20: note: suggested alternative: ‘FILAMENT_UNLOAD_PURGE_RETRACT’
(FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILAMENT_UNLOAD_PURGE_RETRACT

I’ve been having to add this line in for awhile now, not sure why it’s missing:

#define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload

@Lord-Quake

You need to use the configs that are found in the Marlin folder and edit these to your needs. Don’t use the ones found in the config/example folder. They don’t seem to be updated for 2.0.2

@Hesi-Re

I just added this line to my configuration_adv.h file:

#define FILAMENT_UNLOAD_PURGE_FEEDRATE 10 // (mm/s) Unload purge filament feedrate. This can be pretty fast.

Now it compiles without errors!

@spooky79

You need to use the configs that are found in the Marlin folder and edit these to your needs. Don’t use the ones found in the config/example folder. They don’t seem to be updated for 2.0.2

manually configured the same problem

VS Code terminal output
«`
In file included from Marlinsrcmodule/stepper.h:47:0,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:701:0: warning: «enable_Z» redefined
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); Z4_enable(); }while(0)

In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:142:0: note: this is the location of the previous definition
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)

In file included from Marlinsrcmodule/stepper.h:47:0,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:702:0: warning: «disable_Z» redefined
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); Z4_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:143:0: note: this is the location of the previous definition
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

Compiling .piobuildSTM32F103RC_bigtree_512Ksrcsrcfeaturebedlevelablabl.cpp.o
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:45:1: error: default argument given for parameter 1 of ‘void idle(bool)’ [-fpermissive]
);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:41:6: note: previous specification in ‘void idle(bool)’ here
void idle(
^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:47:61: error: default argument given for parameter 1 of ‘void manage_inactivity(bool)’ [-fpermissive]
void manage_inactivity(const bool ignore_stepper_queue=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:47:6: note: previous specification in ‘void manage_inactivity(bool)’ here
void manage_inactivity(const bool ignore_stepper_queue=false);
^~~~~~~~~~~~~~~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 1 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 2 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40:0,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 3 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:0:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
compilation terminated due to -fmax-errors=5.

@DerAndere1

@Scope666

If I modify Marlin 2.0.2, according to comment #16691 (comment) and replace the configs with an example config from https://github.com/MarlinFirmware/Configurations, I can compile sucessfully using the Arduino IDE.

I thought we were encouraged to use VSCode / PlatformIO ? More to the point the repository probably needs to be fixed if it can’t be compiled because of extra files present.

@Lord-Quake

Update:

  • The G60/61 bug in the OP has been patched.

Download Marlin 2.0.2 again.

There is still the issue with Marlin.h and Marlin.cpp.
To solve this you must delete the files
.../Marlin/src/Marlin.h
and
.../Marlin/src/Marlin.cpp
Do not rename nor copy them in a newly created folder within Marlin.

You should now be able to compile successfully. In my case with «STM32F103RC_bigtree_512K»
If you still have an issue then it’s best you post your configs:
Configuration.h
Configuration_adv.h
platformio.ini

@qwewer0



Copy link


Contributor

Author

20.01.28. Still can’t compile 2.0.2. Will wait for official fix.

@Lord-Quake

Post your config files so we can take a look.

@qwewer0



Copy link


Contributor

Author

See it on the first comment.

@qwewer0



Copy link


Contributor

Author

I usually don’t update to Bugfix because of the potential bugs in that, that’s why I waited for 2.0.2, but it still got one in.

why? that will be a frozen copy as soon its out and 2.0.x will move on

but your call

will close this one

I just cloned the latest Bugfix and my configs, it just worked. Don’t know why wouldn’t work for you.

What did you do to make it compile. I cloned a fresh copy, used the Ender 3 configuration files and it does not build.

Even with default config, not using Ender 3 configs does not compile

@qwewer0



Copy link


Contributor

Author

If this is still a problem, then we need to reopen it.

will close this one

@rs-development

Should it compile with the default config files included in 2.0.x? If not, can you provide yours for testing?

@qwewer0



Copy link


Contributor

Author

Try Bugfix-2.0.x, my configs are in the first comment.

Should it compile with the default config files included in 2.0.x? If not, can you provide yours for testing?

@rs-development

Try Bugfix-2.0.x, my configs are in the first comment.

Should it compile with the default config files included in 2.0.x? If not, can you provide yours for testing?

It does compile fine! I assumed 2.0.x is ahead of 2.0.2 but it is not. All good but maybe make sure future releases can be at least built. That is the point of a release in my opinion.

@dshokouhi

I also just did a fresh build from bugfix-2.0.x and I get the exact same errors as noted here: #16691 (comment)

@rs-development

I also just did a fresh build from bugfix-2.0.x and I get the exact same errors as noted here: #16691 (comment)

e4eaf32 does compile fine for me with PlatformIO

@Lord-Quake

The Bugfix-2.0.x is sound and this thread need not be reopened.
For those still having a problem should open a new issue.

@qwewer0



Copy link


Contributor

Author

True

The Bugfix-2.0.x is sound and this thread need not be reopened.
For those still having a issue should open a new issue.

@sjasonsmith

why? that will be a frozen copy as soon its out and 2.0.x will move on

A frozen version (that works) is exactly what most people need. As long as there is a stable released version, people should only need to use the bugfix branch if they actually need a bug fix or want to help out by testing the latest code. I feel it is incorrect to unconditionally encourage all users to use the unstable bugfix branch.

@Lord-Quake

@sjasonsmith I agree completely as the situation with the philosophy used by Marlin is a bit unorthodox and strays from usual practices IMO.
I think @thinkyhead should chime in on this and give his thoughts on the matter as I’ve also mentioned it in the past as well. Don’t know however if the subject of discussion is placed here correctly.

@boelle

I feel it is incorrect to unconditionally encourage all users to use the unstable bugfix branch.

i did not mean it like that, its more that people think the highest mumbers is the latest,
but yes common sense should always be applied and people should try both bugfix 2.0.x and 2.0.2 (or whatever the highest number is)

@boelle

not sure if this one is related but it might be
#16709

@Walstad83

still get the same faults with 2.0.2

default argument given for parameter 1 of 'void manage_inactivity(bool)' [-fpermissive]
default argument given for parameter 1 of 'void kill(const char*, const char*, bool)' [-fpermissive]
default argument given for parameter 1 of 'void minkill(bool)' [-fpermissive]

going over 2 bugfix as a temporary solution as commented over here.

@morganlowe

VS Code terminal output
«`
Compiling .piobuildLPC1768srcsrcfeaturebedlevelublubl.cpp.o
In file included from Marlinsrcmodule/stepper.h:47,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:701: warning: «enable_Z» redefined
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); Z4_enable(); }while(0)

In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:142: note: this is the location of the previous definition
#define enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)

In file included from Marlinsrcmodule/stepper.h:47,
from MarlinsrcMarlin.cpp:37:
Marlinsrcmodule/stepper/indirection.h:702: warning: «disable_Z» redefined
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); Z4_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:143: note: this is the location of the previous definition
#define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)

Compiling .piobuildLPC1768srcsrcfeaturebedlevelublubl_G29.cpp.o
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:45:1: error: default argument given for parameter 1 of ‘void idle(bool)’ [-fpermissive]
);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:41:6: note: previous specification in ‘void idle(bool)’ here
void idle(
^~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:47:61: error: default argument given for parameter 1 of ‘void manage_inactivity(bool)’ [-fpermissive]
void manage_inactivity(const bool ignore_stepper_queue=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:47:6: note: previous specification in ‘void manage_inactivity(bool)’ here
void manage_inactivity(const bool ignore_stepper_queue=false);
^~~~~~~~~~~~~~~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 1 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 2 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
In file included from Marlinsrclcd/ultralcd.h:40,
from MarlinsrcMarlin.cpp:34:
Marlinsrclcd/../MarlinCore.h:68:106: error: default argument given for parameter 3 of ‘void kill(const char*, const char*, bool)’ [-fpermissive]
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^
In file included from MarlinsrcMarlin.cpp:31:
MarlinsrcMarlin.h:325:6: note: previous specification in ‘void kill(const char*, const char*, bool)’ here
void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
^~~~
compilation terminated due to -fmax-errors=5.
*** [.piobuildLPC1768srcsrcMarlin.cpp.o] Error 1
======================================================================== [FAILED] Took 5.21 seconds ========================================================================

Environment Status Duration


megaatmega2560 IGNORED
megaatmega1280 IGNORED
rambo IGNORED
FYSETC_F6_13 IGNORED
FYSETC_F6_14 IGNORED
sanguino_atmega644p IGNORED
sanguino_atmega1284p IGNORED
melzi IGNORED
melzi_optiboot IGNORED
at90usb1286_cdc IGNORED
at90usb1286_dfu IGNORED
DUE IGNORED
DUE_USB IGNORED
DUE_debug IGNORED
LPC1768 FAILED 00:00:05.211

</details>

Failed, downloaded again this morning. So where's the old versions?

@Lord-Quake

You are using an outdated version of Marlin firmware which will cause the errors you are witnessing.

@morganlowe

You are using an outdated version of Marlin firmware which will cause the errors you are witnessing.

2.0.2 downloaded from https://marlinfw.org/meta/download/ is an old version? I don’t think so, unless they aren’t keeping the website updated. Got any more info?

Now Marlin 2.0.1 compiled just fine. I had a copy of it around from some of the other printers.

@Lord-Quake

@morganlowe

Ah right, I missed that skimming over this monster. I’ll stick with 2.0.1 for now, I don’t feel like messing around with a nightly and a mod on these machines as they are in production.

Thanks!

@thinkyhead

Sorry about that. There was a merge problem that left some old files in place instead of deleting them! It is fixed now. Just re-download 2.0.2.

@dok-net

@thinkyhead You got 8.6k forks. I am not quite innocent with my own repos, but then, I have nowhere as many users. Are you aware that force-pushing branches or changing tags causes havoc for all clones of a repository? Like me, I now have to delete the 2.0.2 tag, otherwise, I would never see which commit you have tagged now after the fix.
I’ve noticed before that you have been force-pushing on release, that’s bad git practice on a public repository.
In this current case, as things have been done, you should probably still throw a 2.0.3 release tag.

On another note, have you thought about using the new (https://github.com/MarlinFirmware/Configurations) as a submodule in (https://github.com/MarlinFirmware/Marlin)? I know that there are no «perfect» solutions to version-dependeny between not-quite-loosely coupled projects using git alone, but right now, I think this will give everyone a headache, once a change in Marlin causes a cascade into Configurations, automated or manual, done by you — thanks for that — it becomes unnecessarily hard for anyone to figure out which commit of either repo belongs to the other, until the next release tag is attached. Am I stating myself clear or should I elaborate more on this?

So thanks for this great software, the war that broke out here over a troubled release, and those strange suggestions to «just» switch to unstable, should raise some eyebrows over what the QA for releases actually is. I’d say, gathering bug reports on a release version is fine, but then you can be brave enough to admit and assign a new release shortly after, if there’s something broken — moving the tag makes many even more miserable, and in history, it becomes a riddle what the issue and PR discussions where all about in the first place :-) :-)

@dok-net

@thinkyhead BTW : the config directory now is not empty, again… another merge fail? #16724

@Lord-Quake

I this current case, as things have been done, you should probably still throw a 2.0.3 release tag.

That would be my expectation as well.

@github-actions

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Об ошибках и решениях с параметрами по умолчанию

Программа ошибок

#include <iostream>
using namespace std;
static int count = 0;
void print_str(char *str, int n, int &ref = count);
int main()
{
    char *str = (char *)"Hello World!";
    print_str(str, 0);
    cout << endl;
    print_str(str, 1);
    cout << endl;
    print_str(str, 1);
    return 0;
}

void print_str(char *str, int n, int &ref = count)
{
    ++ref;
    if (n)
    {
        for (int i = 0; i < ref; i++)
        {
            cout << str << endl;
        }
    }
    else
    {
        cout << str << endl;
    }
}

2. Результаты компиляции следующие:

1.printstr.cpp:14:50: error: default argument given for parameter 3 of 'void print_str(char*, int, int&)' 
[-fpermissive]
 void print_str(char *str, int n, int &ref = count)  
                                              ^  
1.printstr.cpp:4:6: note: previous specification in 'void print_str(char*, int, int&)' here
 void print_str(char *str, int n, int &ref = count); 

3. Причина ошибки:

Параметр по умолчанию может быть указан только один раз. Только значение по умолчанию указанного параметра в объявлении и определении функции. Если оба указаны как незаконные;
Компилятор Причина, по которой эта ситуация незаконна: если разные значения по умолчанию указаны в декларации и определении, компилятор не сможет определить, какое значение используется в качестве значения по умолчанию. параметров.

4. После модификации:

5. Компиляция и бежать гладко

    msm.ru

    Нравится ресурс?

    Помоги проекту!

    [!] Как относитесь к модерированию на этом форуме? Выскажите свое мнение здесь

    >
    Функции с параметрами по-умолчанию
    , Компилятор GCC

    • Подписаться на тему
    • Сообщить другу
    • Скачать/распечатать тему



    Сообщ.
    #1

    ,
    03.04.07, 18:35

      Junior

      *

      Рейтинг (т): 1

      Компилятор GCC.
      Есть программа:

      ExpandedWrap disabled

        int f(int a = 0);

        int main()

        {

            std::cout<<f(2);

            return 0;

        }

        int f(int a = 0)

        {

            return a;  

        }

      Компилятор ругаеться:

      Цитата

      error: after previous specification in `int f(int)’ line 1
      error: default argument given for parameter 1 of `int f(int)’ line 11

      Что это значит? Неужели в GCC нельзя использовать параметры по-умолчанию? :blink:
      P.S.
      Поиск не дал результатов, нашел только это: http://caxapa.ru/18298.html?hilite=%F3%EC%EE%EB%F7%E0%ED%E8%FE+GCC&todo=full

      Master

      archimed7592



      Сообщ.
      #2

      ,
      03.04.07, 18:40

        параметр по умолчанию нужно указывать только в объявлении ф-ции…


        ccop



        Сообщ.
        #3

        ,
        03.04.07, 19:26

          Junior

          *

          Рейтинг (т): 1

          Спасибо, будем знать :)


          LPBOY



          Сообщ.
          #4

          ,
          04.04.07, 13:19

            Цитата archimed7592 @ 03.04.07, 18:40

            параметр по умолчанию нужно указывать только в объявлении ф-ции…

            Можно и в определении, но только если определение находится выше вызова функции. Ошибка в примере в том, что агумент по умолчанию задан более одного раза.

            ExpandedWrap disabled

              int f(int a);

              int f(int a = 0) // ok

              {

                  return a;  

              }

              int main()

              {

                  std::cout << f();

                  return 0;

              }

            ExpandedWrap disabled

              int f(int a = 0);

              int f(int a = 0); // error

              int f(int a)

              {

                  return a;  

              }

            ExpandedWrap disabled

              int f(int a, int b = 1, int c = 2);

              //int f(int a = 3, int b = 1, int c = 2); // error

              int f(int a = 3, int b, int c) // ok

              {

                  return a + b + c;  

              }

            Master

            archimed7592



            Сообщ.
            #5

            ,
            04.04.07, 13:37

              смысла большого указывать в определении не вижу… либо определение сразу является объявлением (вся реализация в хэдере), либо указывать только в объявлении (когда реализация в отдельном модуле)…


              LPBOY



              Сообщ.
              #6

              ,
              04.04.07, 14:26

                Цитата archimed7592 @ 04.04.07, 13:37

                смысла большого указывать в определении не вижу…

                Насчет смысла не знаю, я написал из-за чего ругается компилятор. ;)

                Сообщение отредактировано: LPBOY — 04.04.07, 14:27

                0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

                0 пользователей:

                • Предыдущая тема
                • C/C++: Прочее
                • Следующая тема

                Рейтинг@Mail.ru

                [ Script execution time: 0,0305 ]   [ 16 queries used ]   [ Generated: 9.02.23, 13:16 GMT ]  

                Я думаю, что прохождение по ссылке здесь не имеет особого смысла.

                Одной из причин прохождения по ссылке было бы использовать параметр как возвращаемое значение (так что измените ввод), но тогда значение по умолчанию не имеет большого смысла.

                Другой причиной перехода по ссылке может быть некоторое улучшение производительности, чтобы не копировать все данные. Это не критично für cv :: Mat, так как в любом случае копируется только заголовок и поле данных по ссылке/указателю. Если вам нужно очень часто вызывать эту функцию, возможно, у вас может быть улучшение производительности, не копируя заголовок, но в этом случае вы не хотите иметь значение по умолчанию, которое все время создает новый cv :: Mat.

                Поэтому мое решение вашей проблемы состояло бы в том, чтобы передать значение:

                cv::Mat function(cv::Mat matrix = cv::Mat::eye(2,3, CV_32F))
                {
                    return matrix;
                }
                
                int main()
                {
                    std::cout << function() << "nn" ;
                
                    std::cout << function(cv::Mat::zeros(2,3, CV_32F)) << std::endl;
                
                    return 0;
                }
                

                дает мне этот вывод терминала как ожидаемый/ожидаемый:

                [1, 0, 0;
                  0, 1, 0]
                
                [0, 0, 0;
                  0, 0, 0]
                

                Понравилась статья? Поделить с друзьями:
              • Error default argument for template parameter for class enclosing
              • Error decryption failed no vault secrets were found that could decrypt
              • Error decompressing unknown compression method weak auras
              • Error decompressing mp3 file
              • Error decompressing data corrupted installer перевод