Fatal error c1075 no matching token found

fatal error C1075: end of file found before the left brace ‘do not match. I can’t tell you which one is missing because you didn’t post all the code. What part of the error message are you having difficulty comprehending? >>OK THIS IS THE ENTIRE THING, HOPE SOMEONE CAN SEE WHAT IM MISSING Just […]

Содержание

  1. fatal error C1075: end of file found before the left brace ‘<‘ at ‘c:documents and s
  2. All 21 Replies
  3. Fatal error c1075 no matching token found
  4. Fatal error C1075: «<«: не найдена несоответствующая лексема
  5. Ошибка компилятора C2672
  6. Пример
  7. Fatal error c1075 no matching token found

fatal error C1075: end of file found before the left brace ‘<‘ at ‘c:documents and s

Hi everyone I need help with something

i get this error

and i get the error around here

somewhere in there It gives me the error of

if anyone knows what im missing and where it is post a reply because this is the only error I have and I would like to get it fixed

    12 Contributors 21 Replies 7K Views 7 Years Discussion Span Latest Post 7 Years Ago Latest Post by kuroshmokhtari

isn’t it obvious what your program is missing? There error message said it all — the < and >do not match. I can’t tell you which one is missing because you didn’t post all the code.

What part of the error message are you having difficulty comprehending?

>>OK THIS IS THE ENTIRE THING, HOPE SOMEONE CAN SEE WHAT IM MISSING
Just look at the last line of the code you posted. The code isn’t all there because the last function is …

Thanks for the help ill see if it helps and ill contact you if it dusnt when ur online

ANYONE ELSE READING THIS FEEL FREE TO GIVE ME YOUR RESPONSES FROM YOUR OPINION

As others have said, the error is clear, though it can be time-consuming to track down. …

Another way I have used to find missing braces is to comment out large blocks of code until the error goes away. You can narrow down the problem that way.

isn’t it obvious what your program is missing? There error message said it all — the < and >do not match. I can’t tell you which one is missing because you didn’t post all the code.

Hi everyone I need help with something

i get this error

and i get the error around here

somewhere in there It gives me the error of

if anyone knows what im missing and where it is post a reply because this is the only error I have and I would like to get it fixed

OK THIS IS THE ENTIRE THING, HOPE SOMEONE CAN SEE WHAT IM MISSING

Please tell me if you can help me solve this error and the error again is

What part of the error message are you having difficulty comprehending?

I’m specifically having problems somewhere around the text above and this is the error

Accoding to this im missing a brace or i put one extra but i tried and i cant find out, if anyone can find the error please comment me and tell me

You will have count the braces. For each < there must be a matching >.

>>OK THIS IS THE ENTIRE THING, HOPE SOMEONE CAN SEE WHAT IM MISSING
Just look at the last line of the code you posted. The code isn’t all there because the last function is not complete.

And please use code tags the next time you dump all that code here. Here is how to do it.

[code=cplusplus] // your code goes here

Also please read this thread.

Thanks for the help ill see if it helps and ill contact you if it dusnt when ur online

ANYONE ELSE READING THIS FEEL FREE TO GIVE ME YOUR RESPONSES FROM YOUR OPINION

Thanks for the help ill see if it helps and ill contact you if it dusnt when ur online

ANYONE ELSE READING THIS FEEL FREE TO GIVE ME YOUR RESPONSES FROM YOUR OPINION

As others have said, the error is clear, though it can be time-consuming to track down. You have a brackets problem. Somewhere there is a starting < with no matching ending >. Your job is to find it. Constant code indentation is critical for this. I personally prefer to use this type of formatting:

rather than this type:

since I find brackets matching easier using the first way. There are also many good IDEs like NetBeans and Visual Studio where you can minimize and expand bracket sections quickly by clicking the + and — signs next to the brackets. If you have a very short function and expanding the function makes it 100 lines long, chances are that’s your problem. The method is kind of trial and error and methodical noting of starting and ending brackets line numbers on a piece of paper till you find an extra bracket or a missing bracket. You can also quickly comment out and put back in large chunks of code sometimes, but mostly it’s plain old boring brackets counting.

Источник

Fatal error c1075 no matching token found

I’m trying to compile a CHUMP program and keep getting this error message

I read other forums talking about this error and I can’t seem to put my finger on what I’m doing wrong. I click on the error link and all it does is it brings me to the .cpp file. It does not direct me to an area in visual studio on where the issue may be. I look at the brackets and compare them to other programs and everything seems fine.

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

///
/// Summary for Form1
///
public ref class Form1 : public System::Windows::Forms::Form
<
public:
Form1(void)
<
InitializeComponent();
//
//TODO: Add the constructor code here
//
>

protected:
///
/// Clean up any resources being used.
///

Form1()
<
if (components)
<
delete components;
>
>
private: System::Windows::Forms::Button^ btnCreate;
protected:

protected:
private: System::Windows::Forms::TextBox^ txtItems;
private: System::Windows::Forms::TextBox^ txtLog;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;

private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
///
/// Required method for Designer support — do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
<
this->btnCreate = (gcnew System::Windows::Forms::Button());
this->txtItems = (gcnew System::Windows::Forms::TextBox());
this->txtLog = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// btnCreate
//
this->btnCreate->Location = System::Drawing::Point(317, 44);
this->btnCreate->Name = L»btnCreate»;
this->btnCreate->Size = System::Drawing::Size(112, 30);
this->btnCreate->TabIndex = 0;
this->btnCreate->Text = L»Create Log»;
this->btnCreate->UseVisualStyleBackColor = true;
this->btnCreate->Click += gcnew System::EventHandler(this, &Form1::btnCreate_Click);
//
// txtItems
//
this->txtItems->Font = (gcnew System::Drawing::Font(L»Microsoft Sans Serif», 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast (0)));
this->txtItems->Location = System::Drawing::Point(60, 50);
this->txtItems->Name = L»txtItems»;
this->txtItems->Size = System::Drawing::Size(110, 29);
this->txtItems->TabIndex = 1;
this->txtItems->TextAlign = System::Windows::Forms::HorizontalAlignment::Right;
//
// txtLog
//
this->txtLog->Location = System::Drawing::Point(60, 100);
this->txtLog->Multiline = true;
this->txtLog->Name = L»txtLog»;
this->txtLog->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
this->txtLog->Size = System::Drawing::Size(358, 450);
this->txtLog->TabIndex = 2;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(57, 34);
this->label1->Name = L»label1″;
this->label1->Size = System::Drawing::Size(80, 13);
this->label1->TabIndex = 3;
this->label1->Text = L»Items produced»;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(200, 84);
this->label2->Name = L»label2″;
this->label2->Size = System::Drawing::Size(75, 13);
this->label2->TabIndex = 4;
this->label2->Text = L»Production log»;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(484, 562);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->txtLog);
this->Controls->Add(this->txtItems);
this->Controls->Add(this->btnCreate);
this->Name = L»Form1″;
this->Text = L»CHUMP Quality Control Program»;
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();

>
#pragma endregion
//Instance variables
Random^ randomNumGen;
String^ strLog;

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) <
DateTime now = DateTime::Now; // Used as seed value
randomNumGen = gcnew Random(now.Millisecond);
strLog = gcnew String(«ItemttThicknessrn»);
txtItems->Text = «100»;
>
private: System::Void btnCreate_Click(System::Object^ sender, System::EventArgs^ e) <
int items;
double thick;

Int32::TryParse(txtItems->Text, items);
for (int i = 0; i Next(0,1000) /100.0;
strLog += «CHUMP » + i + «:t» + thick + » mmrn»;
>
txtLog->Text = strLog;
>;
>

Источник

Fatal error C1075: «<«: не найдена несоответствующая лексема

ГДЕ ТУТ БЛЯТЬ ОШИБКА!?

void setup_main_menu()
<
static auto set_sub = [](int sub) -> void <
g_cfg.menu.group_sub = sub;
>;
static auto set_tabsub = [](int sub) -> void <
g_cfg.menu.tab_sub = sub;
>;

void setup_main_menu()
<
static auto set_sub = [](int sub)->void
<
g_cfg.menu.group_sub = sub;
>
>;
static auto set_tabsub = [](int sub) -> void
<
g_cfg.menu.tab_sub = sub;
>
>;

void setup_main_menu()
<
static auto set_sub = [](int sub)->void
<
g_cfg.menu.group_sub = sub;
>
>;
static auto set_tabsub = [](int sub) -> void
<
g_cfg.menu.tab_sub = sub;
>
>;

Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: [email protected]

Источник

Ошибка компилятора C2672

«function«: соответствующая перегруженная функция не найдена

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

При использовании определенных стандартных контейнеров или алгоритмов библиотеки типы должны предоставлять доступные члены или дружественные функции, удовлетворяющие требованиям контейнера или алгоритма. Например, типы итератора должны быть производными от std::iterator<> . Для операций сравнения или использования других операторов в типах элементов контейнера может потребоваться, чтобы тип считался как левый, так и как правый операнд. Использование типа в качестве правого операнда может потребовать реализации оператора в качестве функции, не являющейся членом типа.

Пример

Версии компилятора до Visual Studio 2017 не выполняли проверку доступа к полным именам в некоторых контекстах шаблонов. Это может помешать ожидаемой работе SFINAE там, где подстановка должна завершиться ошибкой из-за отсутствия доступа к имени. Такая ситуация может приводить к сбою или неожиданному поведению во время выполнения из-за того, что компилятор неправильно вызывает неверную перегрузку оператора. В Visual Studio 2017 выводится ошибка компилятора.

Этот пример компилируется в Visual Studio 2015, но вызывает ошибку в Visual Studio 2017. Чтобы устранить эту проблему, сделайте элемент параметра шаблона доступным там, где он вычисляется.

Источник

Fatal error c1075 no matching token found

Бывалый

Профиль
Группа: Участник
Сообщений: 230
Регистрация: 9.4.2008

Репутация: нет
Всего: нет

как боротся с подобной ошибкой

shuttle
Дата 27.4.2009, 05:28 (ссылка) | (нет голосов) Загрузка .
Код
fatal error C1075: end of file found before the left brace ‘ <‘ at ‘путь до файла’

Создал Win32 -> Windows application ->empty project. Далее накидал код и вылезла подобная ошибка.

Шустрый

Профиль
Группа: Участник
Сообщений: 59
Регистрация: 3.5.2006

Репутация: нет
Всего: нет

Zakary
Дата 27.4.2009, 05:42 (ссылка) | (нет голосов) Загрузка .
Rickert
Дата 27.4.2009, 06:34 (ссылка) | (нет голосов) Загрузка .

Ситхи не пройдут!

Профиль
Группа: Комодератор
Сообщений: 3356
Регистрация: 11.7.2006
Где: Лакрима

Репутация: нет
Всего: 52

любитель

Профиль
Группа: Участник Клуба
Сообщений: 7954
Регистрация: 14.1.2006

Репутация: 79
Всего: 250

не старайтесь выдать явление наоборот, иначе в будущем такой подход в программировании сильно подпортит жизнь.
Не «символ после..» , а «конец файла до..» и эти формулировки не идентичны.

Это сообщение отредактировал(а) mes — 27.4.2009, 09:45

mes
Дата 27.4.2009, 09:45 (ссылка) | (голосов:2) Загрузка .

1. Публиковать ссылки на вскрытые компоненты

2. Обсуждать взлом компонентов и делиться вскрытыми компонентами

  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда
  • Вопросы по реализации алгоритмов рассматриваются здесь
  • FAQ раздела лежит здесь!

Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, JackYF, bsa.

Правила форума «C/C++: Для новичков»
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | C/C++: Для новичков | Следующая тема »

[ Время генерации скрипта: 0.1028 ] [ Использовано запросов: 21 ] [ GZIP включён ]

Источник

Adblock
detector

im having a issue with a code on AuthServer.cpp giving me the error above, can u help me fix it ??

//-----------------------------------------------------------------------------------
//      Auth Server
//-----------------------------------------------------------------------------------

#include "stdafx.h"
#include "AuthServer.h"
#include "mysql.h"

Database* db_acc;
Database* db_log;


CAuthServer::CAuthServer()
{
    m_pMasterServerSession = NULL;
    m_pClientAcceptor = NULL;
    m_pServerConnector = NULL;
}

CAuthServer::~CAuthServer()
{

}


int     CAuthServer::OnInitApp()
{
    m_nMaxSessionCount = m_config.nMaxConnection + 2;

    NTL_PRINT(PRINT_APP, "Init Timed-Event Manager");
    EventMgr* m_pEventMgr = new EventMgr;
    UNREFERENCED_PARAMETER(m_pEventMgr);

    NTL_PRINT(PRINT_APP,"INIT NEIGHBOR SERVER INFO MANAGER");
    m_pNeighborServerInfoManager = new CSubNeighborServerInfoManager;
    g_pServerInfoManager->Create(NTL_SERVER_TYPE_AUTH);

    m_pSessionFactory =  new CAuthSessionFactory;
    if( NULL == m_pSessionFactory )
    {
        return NTL_ERR_SYS_MEMORY_ALLOC_FAIL;
    }

    return NTL_SUCCESS;
}

int     CAuthServer::OnCreate()
{
    return NTL_SUCCESS;
}

void    CAuthServer::OnDestroy()
{
}


int     CAuthServer::OnAppStart()
{
    int rc = NTL_SUCCESS;

    //client acceptor
    {
        std::unique_ptr<CNtlAcceptor> clientAcceptor(new CNtlAcceptor);
        if (clientAcceptor.get())
        {
            rc = clientAcceptor->Create(m_config.strClientAcceptAddr.c_str(), m_config.wClientAcceptPort, 1, m_config.wClientAcceptPort, SESSION_CLIENT, m_config.nMaxConnection, m_config.nMaxConnection, m_config.nMaxConnection, m_config.nMaxConnection);
            if (NTL_SUCCESS != rc)
            {
                return rc;
            }

            rc = GetNetwork()->Associate(clientAcceptor.get(), true);
            if (NTL_SUCCESS != rc)
            {
                return rc;
            }

            m_pClientAcceptor = clientAcceptor.release();
        }
        else
        {
            return 100003;
        }
    }

    //connector to master server
    {
        std::unique_ptr<CNtlConnector> masterConnector(new CNtlConnector);
        if (masterConnector.get())
        {
            rc = masterConnector->Create(m_config.strMasterServerIP.c_str(), m_config.wMasterServerPort, SESSION_SERVER_CON_AUTH_TO_MASTER, INVALID_DWORD, INVALID_DWORD);
            if (NTL_SUCCESS != rc)
            {
                return rc;
            }

            rc = GetNetwork()->Associate(masterConnector.get(), true);
            if (NTL_SUCCESS != rc)
            {
                return rc;
            }

            m_pServerConnector = masterConnector.release();
        }
        else
        {
            return 100003;
        }
    }

    g_pServerInfoManager->StartEvents();

    return NTL_SUCCESS;
}


bool    CAuthServer::AddPlayer(ACCOUNTID AccID, CClientSession* session)
{
    boost::unordered_map<ACCOUNTID, CClientSession*>::iterator it = m_map_Players.find(AccID);
    if (it == m_map_Players.end()) 
    {
        m_map_Players[AccID] = session;
        return true;
    }

    return false;
}
void    CAuthServer::DelPlayer(ACCOUNTID AccID)
{
    boost::unordered_map<ACCOUNTID, CClientSession*>::iterator it = m_map_Players.find(AccID);
    if (it == m_map_Players.end()) {
        return;
    }

    m_map_Players.erase(AccID);
}
CClientSession* CAuthServer::FindPlayer(ACCOUNTID AccID)
{
    boost::unordered_map<ACCOUNTID, CClientSession*>::iterator it = m_map_Players.find(AccID);
    if (it == m_map_Players.end()) {
    //  NTL_PRINT(PRINT_APP,"[CAuthServer::FindPlayer] %d not found", AccID);
        return NULL;
    }

    return it->second;
}

bool CAuthServer::IsAccountTempBlocked(const char* strUsername)
{
    std::map<std::string, QWORD>::iterator it = m_mapBlockedAccounts.find(strUsername);
    if (it != m_mapBlockedAccounts.end())
    {
        QWORD curTick64 = GetTickCount64();

        if (curTick64 < it->second)
        {
            return true;
        }
        else
        {
            m_mapBlockedAccounts.erase(it);
        }
    }

    return false;
}

void CAuthServer::RegisterAccountTempBann(const char* strUsername)
{
    m_mapBlockedAccounts.insert({ strUsername, GetTickCount64() + 300000 }); //5 minutes
}


void CAuthServer::Run()
{
    DWORD m_dwTickCount, dwLastLoop = 0;
    DWORD m_dwLastTimeGameMainUpdated = GetTickCount(), m_dwQueryTaskRun = GetTickCount();

    while (IsRunnable())
    {
        m_dwTickCount = GetTickCount();

        if (m_dwTickCount - m_dwQueryTaskRun >= 3) //execute every ~3ms
        {
            GetAccDB.QueryTaskRun();

            m_dwQueryTaskRun = m_dwTickCount;
        }

        if (m_dwTickCount - m_dwLastTimeGameMainUpdated >= 1000) //update events every 1000 second
        {
            DWORD dwTickDiff = m_dwTickCount - m_dwLastTimeGameMainUpdated;

            g_pServerInfoManager->TickProcess(dwTickDiff);

            m_dwLastTimeGameMainUpdated = m_dwTickCount;
        }

        dwLastLoop = GetTickCount();

        if (dwLastLoop - m_dwTickCount > 100)
        {
            NTL_PRINT(PRINT_APP, "dwNow %u - dwLastLoop %u = %u > 1000. timeGetTime = %u", m_dwTickCount, dwLastLoop, dwLastLoop - m_dwTickCount, timeGetTime());
            ERR_LOG(LOG_GENERAL, "dwNow %u - dwLastLoop %u = %u > 1000. timeGetTime = %u", m_dwTickCount, dwLastLoop, dwLastLoop - m_dwTickCount, timeGetTime());
        }


        Wait(1);
    }
}


//-----------------------------------------------------------------------------------
//      Purpose :
//      Return  :
//-----------------------------------------------------------------------------------

BOOL CAuthServer::OnCommandInput(std::string& sCmd)
{
    UNREFERENCED_PARAMETER(sCmd);
    //if (sCmd == "networktest")
    //{
    //  NTL_PRINT(PRINT_APP, "START SENDING PACKETS");

    //  for (int i = 0; i < 1000; i++)
    //  {
    //      //send server data to master server
    //      CNtlPacket packet(sizeof(sAM_NOTIFY_SERVER_BEGIN));
    //      sAM_NOTIFY_SERVER_BEGIN * res = (sAM_NOTIFY_SERVER_BEGIN *)packet.GetPacketData();
    //      res->wOpCode = AM_NOTIFY_SERVER_BEGIN;
    //      res->sServerInfo.bIsOn = true;
    //      res->sServerInfo.byRunningState = DBO_SERVER_RUNNING_STATE_RUNNING;
    //      res->sServerInfo.byServerIndex = m_config.byServerId;
    //      res->sServerInfo.dwLoad = 0;
    //      res->sServerInfo.dwMaxLoad = (float)m_config.nMaxConnection * 0.9f;
    //      res->sServerInfo.wPortForClient = m_config.wClientAcceptPort;
    //      strcpy_s(res->sServerInfo.achPublicAddress, NTL_MAX_LENGTH_OF_IP + 1, m_config.strClientAcceptAddr.c_str());
    //      res->sServerInfo.byServerType = NTL_SERVER_TYPE_AUTH;
    //      packet.SetPacketLen(sizeof(sAM_NOTIFY_SERVER_BEGIN));
    //      Send(GetMasterServerHandle(), &packet);
    //  }
    //}

    return TRUE;
}



int main(int argc, _TCHAR* argv[])
{
    CAuthServer app;
    CNtlFileStream traceFileStream;

    SYSTEMTIME ti;
    GetLocalTime(&ti);

    SetConsoleTitle( TEXT("AuthServer") );

    // CHECK INI FILE AND START PROGRAM
    int rc = app.Create(argc, argv, ".\config\AuthServer.ini");
    if (NTL_SUCCESS != rc)
    {
        NTL_PRINT(PRINT_APP, "Server Application Create Fail %d(%s)", rc, NtlGetErrorMessage(rc));
        return rc;
    }


    // LOG FILE
    char m_LogFile[256];
    sprintf(m_LogFile, ".\logs\authserver\log_%02u-%02u-%02u.txt", ti.wYear, ti.wMonth, ti.wDay);

    rc = traceFileStream.Create(m_LogFile);
    if (NTL_SUCCESS != rc)
        return rc;

    app.m_log.AttachLogStream(traceFileStream.GetFilePtr());
    NtlSetPrintFlag(PRINT_APP | PRINT_SYSTEM);

    // CONNECT TO MYSQL DATABASE
    NTL_PRINT(PRINT_APP, "CONNECTING TO DATABASE");

    db_acc = Database::CreateDatabaseInterface(1);
    if (!GetAccDB.Initialize(app.GetDatabaseHost(), 3306, app.GetDatabaseUser(),
        app.GetDatabasePassword(), app.GetDatabaseName(), 5))
    {
        NTL_PRINT(PRINT_APP, "sql : dbo_acc database initialization failed. Exiting.");
        Sleep(5000);
        return 0;
    }

    db_log = Database::CreateDatabaseInterface(1);
    if (!GetLogDB.Initialize(app.GetDatabaseHost(), 3306, app.GetDatabaseUser(),
        app.GetDatabasePassword(), "mustamd467_log", 5))
    {
        NTL_PRINT(PRINT_APP, "sql : dbo_log database initialization failed. Exiting.");
        Sleep(5000);
        return 0;
    }

    NTL_PRINT(PRINT_APP, "CONNECT TO DATABASE SUCCESS");

    unsigned int mysqlthreadsafe = mysql_thread_safe();
    if (!mysqlthreadsafe)
        NTL_PRINT(PRINT_APP, "mysql lib is not a thread safe mode!!!!!!!!!");

    Database::StartThread();

    app.Start();
    NTL_PRINT(PRINT_APP, "AUTH SERVER STARTED");
    app.WaitCommandInput();
    app.WaitForTerminate();
    return 0;
}

|this is the error|

ServerAuthServerAuthServer.h(37): fatal error C1075: ‘{‘: nenhum token correspondente encontrado (compilando arquivo de origem PacketAuthServer.cpp)
1>Projeto de compilação pronto «AuthServer.vcxproj» — FALHA.
========== Compilar: 0 com êxito, 1 com falha, 11 atualizados, 0 ignorados ==========

yaroslavpm98

-8 / 0 / 0

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

Сообщений: 58

1

23.04.2019, 16:32. Показов 29502. Ответов 9

Метки visual basic (Все метки)


помогите пожалуйста, нужно решить задачу, но я не пойму, что не так:

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
35
#include <math.h>
 
#include <iostream>
 
using namespace std;
 
int main()
 
{
 
    double a, x, y, b;
    cout << "x=" << x << endl;
    cin >> x;
    cout << "a=";
    cin >> a;
    cout << "b=";
    cin >> b;
}
    {
    if (a < b);
    {
        cout << "y=" << a * x << endl;
    }
    if (a = b);
    {
        cout << "y=" << a * a + x * x << endl;
    }
    if (a > b);
    {
        cout << "y=" << a * a * a - x << endl;
    }
    
    {   cin.get();
        return 0;
    }

вот что пишет:
Ошибка C1075 «{«: не найдена несоответствующая лексема

Ошибка (активно) E0169 требуется объявление.

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



0



Kuzia domovenok

3986 / 3255 / 910

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

Сообщений: 12,103

Записей в блоге: 1

23.04.2019, 16:39

2

ставил бы теги и писал бы отступы, не допустил бы эту ошибку. Так лучше?
А теперь присмотрись внимательно!

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
#include <math.h>
#include <iostream>
 
using namespace std;
 
int main()
{
  
  double a, x, y, b;
  cout << "x=" << x << endl;
  cin >> x;
  cout << "a=";
  cin >> a;
  cout << "b=";
  cin >> b;
}
{
  if (a < b);
  {
      cout << "y=" << a * x << endl;
  }
  if (a = b);
  {
      cout << "y=" << a * a + x * x << endl;
  }
  if (a > b);
  {
      cout << "y=" << a * a * a - x << endl;
  }
 
  { 
      cin.get();
      return 0;
  }



0



-8 / 0 / 0

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

Сообщений: 58

23.04.2019, 16:49

 [ТС]

3

все равно не пойму



0



Yetty

7423 / 5018 / 2890

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

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

23.04.2019, 17:21

4

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

Решение

yaroslavpm98,

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <cmath>
 
using namespace std;
 
int main()
{  
    double x, a, b, y;
    cout << "x="; cin >> x;
    cout << "a="; cin >> a;
    cout << "b="; cin >> b;
 
    if (a<b) y=a*x;
    else if (a==b) y=a*a+x*x;
    else  y=a*a*a-x;  
 
    cout << "y=" << y << "n";
 
system("pause");
return 0;
}



1



zss

Модератор

Эксперт С++

12641 / 10135 / 6102

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

Сообщений: 27,170

23.04.2019, 17:24

5

Надо убрать точки с запятой в конце строчек с if

Добавлено через 1 минуту

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

if (a = b)

это присвоение

C++
1
if (a == b)



1



223 / 188 / 97

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

Сообщений: 718

23.04.2019, 17:42

6

zss, сравниваете даблы через ==?



0



3986 / 3255 / 910

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

Сообщений: 12,103

Записей в блоге: 1

23.04.2019, 18:58

7

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

это присвоение

для человека, который не может программу в функцию main вставить это не самая грубая ошибка. Я специально молчу, чтобы он научился ошибки исправлять, начиная с самых вопиющих и очевидных, не отвлекаясь на неочевидные



1



7423 / 5018 / 2890

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

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

23.04.2019, 19:05

8

mvngr, здесь double вводятся с клавиатуры, в этом случае можно так сравнивать.



0



3986 / 3255 / 910

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

Сообщений: 12,103

Записей в блоге: 1

23.04.2019, 19:12

9

mvngr, Тут есть нюанс. Оба дабла вводятся с клавиатуры, т.е. парсятся одинаковым оператором ввода из одинаковых прочитанных в консоли строковых значений.
это не сравнение каких-нибудь, например, результатов расчётов. По идее, каждый раз, вводя одинаковую строку в консоль, пользователь будет заполнять переменную идентичным образом и я бы не боялся, что проверка if (a==b) провалится именно в таких обстоятельствах.



0



223 / 188 / 97

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

Сообщений: 718

24.04.2019, 09:02

10

Yetty, Kuzia domovenok, со всеми бывает, буду знать



0



IT_Exp

Эксперт

87844 / 49110 / 22898

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

Сообщений: 92,604

24.04.2019, 09:02

10

  • Forum
  • Beginners
  • What does it mean when code builds succe

What does it mean when code builds successfully, but doesn’t run

Hey!
I have a problem with a program not running. What does it mean when the compiling works, but running the program fails?
I use Visual Studio 2017 btw.

Appreciate all answers:)

Hello ramp00,

The answer to your question is 42. https://www.youtube.com/watch?v=aboZctrHfK8

With out seeing the code one can only guess that you have no syntax errors in the code, but may have logic errors.

Post your code so everyone knows what you are working with.

Andy

what did you mean by fail? did it crash? Did it open a console, generate output, succeed, and close before your finger left the mouse you clicked it with (try adding a cin statement to the end of your program). If it crashed, it means that your syntax was legal but it did something illegal, like trying to modify memory that belongs to a different program (there are an awful lot of ways to crash a program with legal code, this is ONE example).

if it crashed, you have to figure out why and fix it.

Hahha read The hitchhiker’s guide to the galaxy recently, great book;)
But yeah, sorry. Horrible explanation from my side..

I think I found my error though.
The error message from VS was:
fatal error C1075: ‘{‘: no matching token found

1
2
3
4
5
6
if ((tallNedre >= 65 && tallNedre <= 90) && (tallOvre >= 65 && tallNedre <= 90)) { //blahblah
....
....
...
...
}

Apparantly the «//blahblah» comment made the code fail.
I thought commenting inside the code wouldn’t affect the surrounding code, but I suppose I was wrong.
When is the «//» comment applicable, and is there any other way to comment inside the code without ruining it?

foo( /*bar*/ input);
// is until end of this line.
/* is until it sees */, can be many lines or part of one line.
c++ standard is grumpy about nested /* commenting but most compilers deal with it with just a warning.

c++ is also whitespace tolerant.

if(stuff) //if stuff is true do things end of line comment is often all you want or need
but you can also just break the line for most code
if(this && //if this is true, and that is true, then do stuff)
that)

the above is ugly but there are places where it makes sense to do that, and places where it just uglies the code. use your best judgement.

Last edited on

Well if your code snippet is actually exactly the same as the actual code there is nothing wrong with that snippet. As long as there is nothing after that comment (other than a carriage return character) there should be no problem.

The C++ style comments «//» are used for single line comments, everything after the «//» up to the end of the line are part of the comment.

Don’t forget that you could also use C style comments /* This is C style comment */ that have a beginning and ending sequence only the characters between the «/*» and «*/» are part of the comment.

Hmm, yeah I see.
Thanks guys!

Topic archived. No new replies allowed.

Help! I’ve just got back into C++, and I’ve managed to get a C1075!

HELP!

Advice?

Well, posting code that you’re having the problem with would be a start.

Fatal Error C1075

end of file found before the left token at ‘filename(linenumber)’ was matched

The compiler expected matching token before it reached the end of file.

Possible cause

* Unmatched bracket, curly brace, or other paired character

Look through everything to make sure it has matching brackets/parenthesis/etc.

Quote:Original post by SiCrane
Well, posting code that you’re having the problem with would be a start.

Quote:Original post by Crazyfool
end of file found before the left token at ‘filename(linenumber)’ was matched

I presume you’ve edited that message. What does the filename and line number specified look like?

CrazyFool != cj270608

What CrazyFool posted looks like a copy-paste from the C1075 help page.

Quote:Original post by Crazyfool
Possible cause

* Unmatched bracket, curly brace, or other paired character

Well there you have it. We can’t tell you more than the error message already told you (listen to your compiler!) unless you post your program.

Haha, I copied and pasted directly from the first page that came from putting C1075 in google (I didnt know what the error message was) and tried to demonstrate to the OP how easy it is to solve these problems. So far two people thought I was the OP ;)

Crazyfool, excellent response. In the future this may be useful:

letmegooglethatforyou

I know this sounds snide towards CrazyFool, but it isn’t meant to. Quite the opposite. But I think google-awareness is a worthy cause, figured next time you may want to give it a shot :)

Example:

OP’s Answer

_______________________»You’re using a screwdriver to nail some glue to a ming vase. » -ToohrVyk

Quote:Original post by M2tM
letmegooglethatforyou
OP’s Answer

Dammit, I’ve been waiting to use that for a month. [smile]

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error c1060 компилятору не хватает размера кучи
  • Fatal error c1060 compiler is out of heap space
  • Fatal error c1041 cannot open program database
  • Fatal error c1034 windows h no include path set
  • Fatal error c1034 stdio h не указан путь поиска включаемых файлов

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

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