Меню

Error c2143 синтаксическая ошибка отсутствие перед строка

  • Remove From My Forums
  • Question

  • The line of code which is causing this error is:-

    CD3DVertexCache *m_pVertexCache;

    CD3DVertexCache is a class.  Usually this is a stupid error meaning I’ve not included the header file for the class.  However on this occasion I have included the header file for the class.  Further more when I run the mouse cursor over the class name the little message box appears class CD3DVertexCache.  Which tells me the compiler knows of the class identifier.  I’m not sure why I’m getting the error message, wondering if someone can advise what other situations would cause this error to appear?

    Thanks,

    Paul.

Answers

  • Usually means that there is an error or omission in the previous line(s).

    Check for a missing semi-colon or other error(s) in the line(s) immediately

    *before* the one indicated by the error message.

    Check also for a missing semi-colon at the end of class and structure definitions.

    — Wayne

pupsus

2 / 2 / 0

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

Сообщений: 62

1

12.11.2014, 18:38. Показов 25532. Ответов 7

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


Вот текст класса, где собственно говоря вылезает ошибка. Где я мог пропустить «;» никак не пойму. Причем предыдущая строка «Field* field;» ничем не отличается от строки с ошибкой «CSprite* balls;»

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
#pragma once
#include "stdafx.h"
#include "Sprite.h"
#include "Field.h"
 
 
class Balls
{
public:
    Balls(SDL_Renderer* passed_renderer, int x, int y, int w, int h, std::string FilePath);
    ~Balls(void);
 
    void Update();
 
    void SetColor();
    void Draw();
    void Generate();
    
private:
    Field* field;
    CSprite* balls;
    SDL_Renderer* renderer;
    int X;
    int Y;
    int img_width;
    int img_height;
};

текст ошибки:
1>—— Построение начато: проект: My_Game, Конфигурация: Debug Win32 ——
1> Sprite.cpp
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C2143: синтаксическая ошибка: отсутствие «;» перед «*»
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C4430: отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C4430: отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию
1> My_Game.cpp
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C2143: синтаксическая ошибка: отсутствие «;» перед «*»
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C4430: отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C4430: отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию
1> Main.cpp
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C2143: синтаксическая ошибка: отсутствие «;» перед «*»
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C4430: отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию
1>c:usersсаняdocumentsvisual studio 2010projectsmy_gamemy_gameballs.h(21): error C4430: отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию
1> Создание кода…
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========

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



0



16466 / 8966 / 2198

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

Сообщений: 15,566

12.11.2014, 18:48

2

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

Решение

pupsus, эти ошибки говорят о том, что почему-то в этом месте трансляции не видно объявления типа CSprite.
Случайно файлы заголовочные друг от друга не зависят? Нет ли включения в Sprite.h файла Balls.h?



1



2 / 2 / 0

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

Сообщений: 62

12.11.2014, 18:50

 [ТС]

3

есть, а так нельзя делать?



0



16 / 16 / 6

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

Сообщений: 72

12.11.2014, 18:50

4

У деструктора воид убирать надо?



0



2 / 2 / 0

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

Сообщений: 62

12.11.2014, 18:54

 [ТС]

5

все, ошибка исправлена, спасибо)
если не сложно объясните в чем тут дело, почему не могут заголовочные друг на друга ссылаться?

Добавлено через 49 секунд
а зачем у деструктора воид убирать?



0



DrOffset

16466 / 8966 / 2198

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

Сообщений: 15,566

12.11.2014, 18:56

6

Цитата
Сообщение от pupsus
Посмотреть сообщение

есть, а так нельзя делать?

Нельзя. Т.к. будет рекурсивное включение.
Используй предварительное объявление (например в Balls.h), а include «Sprite.h» из Balls.h убери

C++
1
2
3
class CSprite;
 
// код из шапки темы.

заголовочный файл Sprite.h подключай вместо этого в Balls.cpp

Добавлено через 25 секунд

Цитата
Сообщение от pupsus
Посмотреть сообщение

а зачем у деструктора воид убирать?

Можно не убирать. Но вообще в С++ он не обязателен.



1



2 / 2 / 0

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

Сообщений: 62

12.11.2014, 19:02

 [ТС]

7

ясно, спасибо большое очень помогли



0



DrOffset

16466 / 8966 / 2198

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

Сообщений: 15,566

12.11.2014, 19:14

8

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

Решение

Цитата
Сообщение от pupsus
Посмотреть сообщение

если не сложно объясните в чем тут дело, почему не могут заголовочные друг на друга ссылаться?

А включает Б, а Б включает А. Это бесконечная рекурсия. Разрывает ее в данном случае pragma once, но в что-то в любом случае страдает, либо в Balls.h не видно содержимого Sprite, либо наоборот (в зависимости от того что вперед успело включиться).

Добавлено через 10 минут
pupsus,
Вот небольшая иллюстрация на примере include-guards defines (с ними нагляднее, чем с once), но смысл тот же.

C++
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
#ifndef A_TEST
#define A_TEST //A.h (1)
    //include "B.h"
    #ifndef B_TEST
    #define B_TEST
        //include "A.h"
        #ifndef A_TEST
        #define A_TEST //A.h(2)
            // и т.д.
 
            class A
            {
                B * f;
            };
        #endif
        // end include
 
        class B
        {
 
            A * f; // <-- здесь будет ошибка, A не объявлен,
                   // т.к. include guard выше не дал включить A.h
                   // потому что A_TEST уже есть, задефайнен выше (1)
        };
 
    #endif
    //end include
 
    class A
    {
        B * f;
    };
 
#endif //A_TEST



6



I am new to programming C.. please tell me what is wrong with this program, and why I am getting this error: error C2143: syntax error : missing ‘;’ before ‘type’….

extern void func();

int main(int argc, char ** argv){
    func();
    int i=1;
    for(;i<=5; i++) {
        register int number = 7;
        printf("number is %dn", number++);
    }
    getch();
}

asked Mar 29, 2013 at 4:10

eLg's user avatar

9

Visual Studio only supports C89. That means that all of your variables must be declared before anything else at the top of a function.

EDIT: @KeithThompson prodded me to add a more technically accurate description (and really just correct where mine is not in one regard). All declarations (of variables or of anything else) must precede all statements within a block.

answered Mar 29, 2013 at 4:17

Ed S.'s user avatar

Ed S.Ed S.

121k21 gold badges181 silver badges262 bronze badges

2

I haven’t used visual in at least 8 years, but it seems that Visual’s limited C compiler support does not allow mixed code and variables. Is the line of the error on the declaration for int i=1; ?? Try moving it above the call to func();

Also, I would use extern void func(void);

answered Mar 29, 2013 at 4:18

Randy Howard's user avatar

Randy HowardRandy Howard

2,16015 silver badges26 bronze badges

this:

int i=1;
for(;i<=5; i++) {

should be idiomatically written as:

for(int i=1; i<=5; i++) {

because there no point to declare for loop variable in the function scope.

answered Mar 29, 2013 at 4:17

lenik's user avatar

leniklenik

22.9k4 gold badges32 silver badges43 bronze badges

8

I am extremely confused why I am getting this strange error all the sudden:

Time.h is a very simple class, and it has a semicolon at the end of the class description, so I am pretty sure my code is correct here.. Then I get the same errors in: Microsoft Visual Studio 10.0VCincludememory.. Any ideas!?!? Thanks!

Compiler Output

1>ClCompile:
1>  Stop.cpp
1>c:projectnextbusTime.h(17): error C2143: syntax error : missing ';' before 'using'
1>c:projectnextbusTime.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>  NextBusDriver.cpp
1>C:Program Files (x86)Microsoft Visual Studio 10.0VCincludememory(16): error C2143: syntax error : missing ';' before 'namespace'
1>C:Program Files (x86)Microsoft Visual Studio 10.0VCincludememory(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Update:
Can’t really post all the code as this is for a school project and we aren’t supposed to post before we submit, but small snippets should be ok..

Time.h

#ifndef TIME_HPP
#define TIME_HPP

#include <string>
#include <sstream>

using namespace std;

class Time {
// Defines a time in a 24 hour clock

public:
    // Time constructor
    Time(int hours = 0 , int minutes= 0);

    // POST: Set hours int
    void setHours(int h);

    // POST: Set minutes int
    void setMinutes(int m);

    // POST: Returns hours int
    int getHours();

    // POST: Returns minutes int
    int getMinutes();

    // POST: Returns human readable string describing the time
    // This method can be overridden in inheriting classes, so should be virtual so pointers will work as desired
    string toString();

private: 
    string intToString(int num);
    // POST: Converts int to string type

    int hours_;
    int minutes_;

};

#endif

DepartureTime.h (inherited class)

#ifndef DEPARTURE_TIME_HPP
#define DEPARTURE_TIME_HPP

#include <string>
#include "Time.h"

using namespace std;

class DepartureTime: public Time {
public:
    // Departure Time constructor
    DepartureTime(string headsign, int hours=0, int minutes=0) : Time(hours, minutes), headsign_(headsign) { }

    // POST: Returns bus headsign
    string getHeadsign();

    // POST: Sets the bus headsign
    void setHeadsign(string headsign);

    // POST: Returns human readable string describing the departure
    string toString();

private:
    // Class variables
    string headsign_;
};
#endif

I am extremely confused why I am getting this strange error all the sudden:

Time.h is a very simple class, and it has a semicolon at the end of the class description, so I am pretty sure my code is correct here.. Then I get the same errors in: Microsoft Visual Studio 10.0VCincludememory.. Any ideas!?!? Thanks!

Compiler Output

1>ClCompile:
1>  Stop.cpp
1>c:projectnextbusTime.h(17): error C2143: syntax error : missing ';' before 'using'
1>c:projectnextbusTime.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>  NextBusDriver.cpp
1>C:Program Files (x86)Microsoft Visual Studio 10.0VCincludememory(16): error C2143: syntax error : missing ';' before 'namespace'
1>C:Program Files (x86)Microsoft Visual Studio 10.0VCincludememory(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Update:
Can’t really post all the code as this is for a school project and we aren’t supposed to post before we submit, but small snippets should be ok..

Time.h

#ifndef TIME_HPP
#define TIME_HPP

#include <string>
#include <sstream>

using namespace std;

class Time {
// Defines a time in a 24 hour clock

public:
    // Time constructor
    Time(int hours = 0 , int minutes= 0);

    // POST: Set hours int
    void setHours(int h);

    // POST: Set minutes int
    void setMinutes(int m);

    // POST: Returns hours int
    int getHours();

    // POST: Returns minutes int
    int getMinutes();

    // POST: Returns human readable string describing the time
    // This method can be overridden in inheriting classes, so should be virtual so pointers will work as desired
    string toString();

private: 
    string intToString(int num);
    // POST: Converts int to string type

    int hours_;
    int minutes_;

};

#endif

DepartureTime.h (inherited class)

#ifndef DEPARTURE_TIME_HPP
#define DEPARTURE_TIME_HPP

#include <string>
#include "Time.h"

using namespace std;

class DepartureTime: public Time {
public:
    // Departure Time constructor
    DepartureTime(string headsign, int hours=0, int minutes=0) : Time(hours, minutes), headsign_(headsign) { }

    // POST: Returns bus headsign
    string getHeadsign();

    // POST: Sets the bus headsign
    void setHeadsign(string headsign);

    // POST: Returns human readable string describing the departure
    string toString();

private:
    // Class variables
    string headsign_;
};
#endif

Это ошибка синтаксиса. Связана она с отсутствием необходимых разделителей между элементами языка. Компилятор ожидает, что некоторые элементы языка появятся прежде или после других элементов. Если этого не происходит, то он выдаем ошибку. Будем пробовать ее получить. Пишем код:

#include "stdafx.h"
int main(int argc, char* argv[])
{
	int x;
	int y;
	if (x<y) :	// двоеточие здесь совсем не нужно
	{
	}
}

Результат работы компилятора:

D:VСTestErrorTestError.cpp(10) : error C2143: syntax error : missing ';' before ':'

Второй наиболее частый вариант это забыть поставить «;» после объявления класса.

#include "stdafx.h"

class CMy
{
}	// забыли ";"

class CMy2
{
}

int main(int argc, char* argv[])
{
}

Опять та же ошибка.

D:VСTestErrorTestError.cpp(12) : error C2236: unexpected 'class' 'CMy2'
D:VСTestErrorTestError.cpp(12) : error C2143: syntax error : missing ';' before '{'

Еще один вариант с лишней скобки:

#include "stdafx.h"

int main(int argc, char* argv[])
{
}		// это лишнее
return 0;
}

Опять та же ошибка:

D:VСTestErrorTestError.cpp(11) : warning C4508: 'main' : function should return a value; 'void' return type assumed
D:VСTestErrorTestError.cpp(12) : error C2143: syntax error : missing ';' before 'return'

Отсутствие закрывающей скобки может привести к такой же ошибке:

#include "stdafx.h"

int main(int argc, char* argv[])
{
	for (int x=0;x<10;x++		// не хватает ")"
	{
	}
	return 0;
}

Как видите это ошибка связанна с синтаксисом. Если она у Вас появляется внимательно просмотрите код на предмет соответствия требованиям C++ (лишние знаки, забытые 😉

  • Remove From My Forums
  • Question

  • int main(array<System::String ^> ^args)
    {
    	// Enabling Windows XP visual effects before any controls are created
    	Application::EnableVisualStyles();
    	Application::SetCompatibleTextRenderingDefault(false); 
    
    	// Create the main window and run it
    	Application::Run(gcnew Form1());
    
    error at this line -->		  Form1.textBox1="hello";//(MYREC*)pMyCDS->lpData;
    	return 0;
    }

    hello dear forum

    this above code gives folowing errors when compiling

    1>.receiving.cpp(48) : error C2143: syntax error : missing ‘;’ before ‘.’

    1>.receiving.cpp(48) : error C2143: syntax error : missing ‘;’ before ‘.’

    how can I proceed ?

    thank you 

    • Edited by

      Thursday, August 28, 2014 2:20 PM

Answers

  • My bad. Sorry, my brain was thinking in C#, not C++/CLI. (The C# and C++ posts are combined when I view them).

    Regardless, the advice doesn’t change much. Somewhere, InitializeComponent() is being called in one of your *.cpp source files. Use Control-Shift-F12 to locate it.

    The line you need to insert will look something like:

    textBox1->text = L»hello»;

    • Marked as answer by
      May Wang — MSFT
      Friday, September 12, 2014 7:49 AM

  • Further to my last post and Brian’s, try this:

    In the Form1.h design window — where you have the graphical view of your program — double-click
    anywhere on the main form. The editor should open the Form1.h (text) file for you to edit.

    Look for the constructor for Form1. It should look like this:

    public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Add the constructor code here
    			//
    		}
    		

    Add the line to put «Hello» in textBox1.

    public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Add the constructor code here
    			//
                            textBox1->Text = "Hello"; // add here OR in the Form1_Load handler
    		}

    Note that C++/CLI usually uses -> where C# and VB use a period (.).

    An alternative place to put it rather than in the ctor would be in the Form1 load event code.

    The handler code for this event should have been created automatically near the bottom of

    Form1.h when you double-clicked on the main form in the designer.

    #pragma endregion
        private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
            textBox1->Text = "Hello"; // add it here OR in the ctor
            }
    

    — Wayne

    • Edited by
      WayneAKing
      Friday, August 29, 2014 8:34 AM
    • Marked as answer by
      May Wang — MSFT
      Friday, September 12, 2014 7:49 AM

  • ok guys , I understand

    this is completeley different than C 

    why I bothered you with all these questions

    I want receive a data sent from another application with SendMessage function

    	Application::Run(gcnew Form1());
    ....................
    if (WM_COPYDATA){
       pMyCDS = lParam;
    
    	xyz->textBox1->Text=(MYREC*)pMyCDS->lpData;
    .....................
    
    the code between dotted lines should be in an infinite loop to detect coming data
    the code between dotted lines should be in an infinite loop to detect coming data

    if the code never gets below this line

    	Application::Run(gcnew Form1());

    how it is posible to get and display the incoming data ?

    If you need to change the text periodically, then use a timer: open the form in Form Designer (double click on Form1.h in Solution Explorer) and drag a
    Timer component to your form. Then handle the Tick event (double click on the newly added component). Set the
    Enabled property to true to start the timer automatically.

    For simple tests, try this in the Tick handler:

    System::Void timer1_Tick( System::Object^  sender, System::EventArgs^  e )
    {
        textBox1->Text = DateTime::Now.ToLongTimeString();
    }
    

    • Marked as answer by
      May Wang — MSFT
      Friday, September 12, 2014 7:48 AM

  • Remove From My Forums
  • Question

  • int main(array<System::String ^> ^args)
    {
    	// Enabling Windows XP visual effects before any controls are created
    	Application::EnableVisualStyles();
    	Application::SetCompatibleTextRenderingDefault(false); 
    
    	// Create the main window and run it
    	Application::Run(gcnew Form1());
    
    error at this line -->		  Form1.textBox1="hello";//(MYREC*)pMyCDS->lpData;
    	return 0;
    }

    hello dear forum

    this above code gives folowing errors when compiling

    1>.receiving.cpp(48) : error C2143: syntax error : missing ‘;’ before ‘.’

    1>.receiving.cpp(48) : error C2143: syntax error : missing ‘;’ before ‘.’

    how can I proceed ?

    thank you 

    • Edited by

      Thursday, August 28, 2014 2:20 PM

Answers

  • My bad. Sorry, my brain was thinking in C#, not C++/CLI. (The C# and C++ posts are combined when I view them).

    Regardless, the advice doesn’t change much. Somewhere, InitializeComponent() is being called in one of your *.cpp source files. Use Control-Shift-F12 to locate it.

    The line you need to insert will look something like:

    textBox1->text = L»hello»;

    • Marked as answer by
      May Wang — MSFT
      Friday, September 12, 2014 7:49 AM

  • Further to my last post and Brian’s, try this:

    In the Form1.h design window — where you have the graphical view of your program — double-click
    anywhere on the main form. The editor should open the Form1.h (text) file for you to edit.

    Look for the constructor for Form1. It should look like this:

    public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Add the constructor code here
    			//
    		}
    		

    Add the line to put «Hello» in textBox1.

    public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
    			//
    			//TODO: Add the constructor code here
    			//
                            textBox1->Text = "Hello"; // add here OR in the Form1_Load handler
    		}

    Note that C++/CLI usually uses -> where C# and VB use a period (.).

    An alternative place to put it rather than in the ctor would be in the Form1 load event code.

    The handler code for this event should have been created automatically near the bottom of

    Form1.h when you double-clicked on the main form in the designer.

    #pragma endregion
        private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
            textBox1->Text = "Hello"; // add it here OR in the ctor
            }
    

    — Wayne

    • Edited by
      WayneAKing
      Friday, August 29, 2014 8:34 AM
    • Marked as answer by
      May Wang — MSFT
      Friday, September 12, 2014 7:49 AM

  • ok guys , I understand

    this is completeley different than C 

    why I bothered you with all these questions

    I want receive a data sent from another application with SendMessage function

    	Application::Run(gcnew Form1());
    ....................
    if (WM_COPYDATA){
       pMyCDS = lParam;
    
    	xyz->textBox1->Text=(MYREC*)pMyCDS->lpData;
    .....................
    
    the code between dotted lines should be in an infinite loop to detect coming data
    the code between dotted lines should be in an infinite loop to detect coming data

    if the code never gets below this line

    	Application::Run(gcnew Form1());

    how it is posible to get and display the incoming data ?

    If you need to change the text periodically, then use a timer: open the form in Form Designer (double click on Form1.h in Solution Explorer) and drag a
    Timer component to your form. Then handle the Tick event (double click on the newly added component). Set the
    Enabled property to true to start the timer automatically.

    For simple tests, try this in the Tick handler:

    System::Void timer1_Tick( System::Object^  sender, System::EventArgs^  e )
    {
        textBox1->Text = DateTime::Now.ToLongTimeString();
    }
    

    • Marked as answer by
      May Wang — MSFT
      Friday, September 12, 2014 7:48 AM

ChA0S_f4me

Почему выдает ошибки?

Ошибки:

Ошибка C2143 синтаксическая ошибка: отсутствие «;» перед «}» 74
Ошибка C2143 синтаксическая ошибка: отсутствие «;» перед «<<» 33
Ошибка C2059 синтаксическая ошибка: } 74
Ошибка C4430 отсутствует спецификатор типа — предполагается int. Примечание. C++ не поддерживает int по умолчанию 33
Ошибка C2238 непредвиденные лексемы перед «;» 33
Ошибка C2365 bankScore::score: переопределение; предыдущим определением было «данные-член» 31

Сам код:

class bankScore
{
    private:
        int score = 100,
            scoreNum = 945794982938456;
        bool setedSum = false,
            editedNum = false,
            closed = false;
    public:
        /*void withdraw(int s)
        {
            if (score - s >= 0)
            {
                score -= s;
                cout << "Деньги успешно сняты";
            }
            else {
                cout << "У вас не хватает денег на счету!";
            }
        };
        void deposit(int s)
        {
            score -= s;
            cout << "Деньги успешно внесены";
        };*/
        void score()
        {
            cout << "На вашем счету " << score << " рублей 00 копеек";
        };
        /*void editScore()
        {
            if (!editedNum)
            {
                cout << "Введите новый номер счета (15 цифр): ";
                cin >> scoreNum;
                cout << "nУспешно!";
                editedNum = true;
            }
        };
        void closeScore()
        {
            if (!closed)
            {
                cout << "Если вы закроете счет, вы больше не сможете им воспользоваться, а так-же заново открыть его. Вы уверенны?n1. Уверен(-а)n2. Отмена";
                int yes = _getch();
                switch (yes)
                {
                case 49:
                    cout << "Счет закрыт. До свидания!";
                case 50:
                    cout << "Закрытие счета отменено!";
                    break;
                }
                closed = true;
            }
        };
        void setScore(int s)
        {
            if (!setedSum)
            {
                cout << "Введите сумму: ";
                cin >> score;
                cout << "nУспешно! Сейчас произведется отчистка" << endl;
                _getch();
                system("cls");
                setedSum = true;
            }
        };*/
};


  • Вопрос задан

    более двух лет назад

  • 298 просмотров

Не уверен по поводу чего большинство ошибок, но у тебя определены переменная и функция с одним именем. А так как они располагаются в одной области имен — это проблема. Вот и ругается Ошибка C2365 bankScore::score: переопределение; предыдущим определением было «данные-член» 31. Просто прочитай и все.

Пригласить эксперта


  • Показать ещё
    Загружается…

28 янв. 2023, в 22:48

500 руб./за проект

28 янв. 2023, в 20:58

30000 руб./за проект

28 янв. 2023, в 20:46

50000 руб./за проект

Минуточку внимания

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Error c2061 синтаксическая ошибка идентификатор listbox
  • Error c2059 синтаксическая ошибка строка