| description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid |
|---|---|---|---|---|---|
|
Learn more about: Compiler Error C2065 |
Compiler Error C2065 |
06/29/2022 |
C2065 |
C2065 |
78093376-acb7-45f5-9323-5ed7e0aab1dc |
Compiler Error C2065
‘identifier‘ : undeclared identifier
The compiler can’t find the declaration for an identifier. There are many possible causes for this error. The most common causes of C2065 are that the identifier hasn’t been declared, the identifier is misspelled, the header where the identifier is declared isn’t included in the file, or the identifier is missing a scope qualifier, for example, cout instead of std::cout. For more information on declarations in C++, see Declarations and Definitions (C++).
Here are some common issues and solutions in greater detail.
The identifier is undeclared
If the identifier is a variable or a function name, you must declare it before it can be used. A function declaration must also include the types of its parameters before the function can be used. If the variable is declared using auto, the compiler must be able to infer the type from its initializer.
If the identifier is a member of a class or struct, or declared in a namespace, it must be qualified by the class or struct name, or the namespace name, when used outside the struct, class, or namespace scope. Alternatively, the namespace must be brought into scope by a using directive such as using namespace std;, or the member name must be brought into scope by a using declaration, such as using std::string;. Otherwise, the unqualified name is considered to be an undeclared identifier in the current scope.
If the identifier is the tag for a user-defined type, for example, a class or struct, the type of the tag must be declared before it can be used. For example, the declaration struct SomeStruct { /*...*/ }; must exist before you can declare a variable SomeStruct myStruct; in your code.
If the identifier is a type alias, the type must be declared by a using declaration or typedef before it can be used. For example, you must declare using my_flags = std::ios_base::fmtflags; before you can use my_flags as a type alias for std::ios_base::fmtflags.
Example: misspelled identifier
This error commonly occurs when the identifier name is misspelled, or the identifier uses the wrong uppercase and lowercase letters. The name in the declaration must exactly match the name you use.
// C2065_spell.cpp // compile with: cl /EHsc C2065_spell.cpp #include <iostream> using namespace std; int main() { int someIdentifier = 42; cout << "Some Identifier: " << SomeIdentifier << endl; // C2065: 'SomeIdentifier': undeclared identifier // To fix, correct the spelling: // cout << "Some Identifier: " << someIdentifier << endl; }
Example: use an unscoped identifier
This error can occur if your identifier isn’t properly scoped. If you see C2065 when you use cout, a scope issue is the cause. When C++ Standard Library functions and operators aren’t fully qualified by namespace, or you haven’t brought the std namespace into the current scope by using a using directive, the compiler can’t find them. To fix this issue, you must either fully qualify the identifier names, or specify the namespace with the using directive.
This example fails to compile because cout and endl are defined in the std namespace:
// C2065_scope.cpp // compile with: cl /EHsc C2065_scope.cpp #include <iostream> // using namespace std; // Uncomment this line to fix int main() { cout << "Hello" << endl; // C2065 'cout': undeclared identifier // C2065 'endl': undeclared identifier // Or try the following line instead std::cout << "Hello" << std::endl; }
Identifiers that are declared inside of class, struct, or enum class types must also be qualified by the name of their enclosing scope when you use them outside of that scope.
Example: precompiled header isn’t first
This error can occur if you put any preprocessor directives, such as #include, #define, or #pragma, before the #include of a precompiled header file. If your source file uses a precompiled header file (that is, if it’s compiled by using the /Yu compiler option) then all preprocessor directives before the precompiled header file are ignored.
This example fails to compile because cout and endl are defined in the <iostream> header, which is ignored because it’s included before the precompiled header file. To build this example, create all three files, then compile pch.h (some versions of Visual Studio use stdafx.cpp), then compile C2065_pch.cpp.
// pch.h (stdafx.h in Visual Studio 2017 and earlier) #include <stdio.h>
The pch.h or stdafx.h source file:
// pch.cpp (stdafx.cpp in Visual Studio 2017 and earlier) // Compile by using: cl /EHsc /W4 /c /Ycstdafx.h stdafx.cpp #include "pch.h"
Source file C2065_pch.cpp:
// C2065_pch.cpp // compile with: cl /EHsc /W4 /Yustdafx.h C2065_pch.cpp #include <iostream> #include "stdafx.h" using namespace std; int main() { cout << "Hello" << endl; // C2065 'cout': undeclared identifier // C2065 'endl': undeclared identifier }
To fix this issue, add the #include of <iostream> into the precompiled header file, or move it after the precompiled header file is included in your source file.
Example: missing header file
The error can occur if you haven’t included the header file that declares the identifier. Make sure the file that contains the declaration for the identifier is included in every source file that uses it.
// C2065_header.cpp // compile with: cl /EHsc C2065_header.cpp //#include <stdio.h> int main() { fpos_t file_position = 42; // C2065: 'fpos_t': undeclared identifier // To fix, uncomment the #include <stdio.h> line // to include the header where fpos_t is defined }
Another possible cause is if you use an initializer list without including the <initializer_list> header.
// C2065_initializer.cpp // compile with: cl /EHsc C2065_initializer.cpp // #include <initializer_list> int main() { for (auto strList : {"hello", "world"}) if (strList == "hello") // C2065: 'strList': undeclared identifier return 1; // To fix, uncomment the #include <initializer_list> line }
You may see this error in Windows Desktop app source files if you define VC_EXTRALEAN, WIN32_LEAN_AND_MEAN, or WIN32_EXTRA_LEAN. These preprocessor macros exclude some header files from windows.h and afxv_w32.h to speed compiles. Look in windows.h and afxv_w32.h for an up-to-date description of what’s excluded.
Example: missing closing quote
This error can occur if you’re missing a closing quote after a string constant. It’s an easy way to confuse the compiler. The missing closing quote may be several lines before the reported error location.
// C2065_quote.cpp // compile with: cl /EHsc C2065_quote.cpp #include <iostream> int main() { // Fix this issue by adding the closing quote to "Aaaa" char * first = "Aaaa, * last = "Zeee"; std::cout << "Name: " << first << " " << last << std::endl; // C2065: 'last': undeclared identifier }
Example: use iterator outside for loop scope
This error can occur if you declare an iterator variable in a for loop, and then you try to use that iterator variable outside the scope of the for loop. The compiler enables the /Zc:forScope compiler option by default. For more information, see Debug iterator support.
// C2065_iter.cpp // compile with: cl /EHsc C2065_iter.cpp #include <iostream> #include <string> int main() { // char last = '!'; std::string letters{ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }; for (const char& c : letters) { if ('Q' == c) { std::cout << "Found Q!" << std::endl; } // last = c; } std::cout << "Last letter was " << c << std::endl; // C2065 // Fix by using a variable declared in an outer scope. // Uncomment the lines that declare and use 'last' for an example. // std::cout << "Last letter was " << last << std::endl; // C2065 }
Example: preprocessor removed declaration
This error can occur if you refer to a function or variable that is in conditionally compiled code that isn’t compiled for your current configuration. The error can also occur if you call a function in a header file that currently isn’t supported in your build environment. If certain variables or functions are only available when a particular preprocessor macro is defined, make sure the code that calls those functions can only be compiled when the same preprocessor macro is defined. This issue is easy to spot in the IDE: The declaration for the function is greyed out if the required preprocessor macros aren’t defined for the current build configuration.
Here’s an example of code that works when you build in Debug, but not Release:
// C2065_defined.cpp // Compile with: cl /EHsc /W4 /MT C2065_defined.cpp #include <iostream> #include <crtdbg.h> #ifdef _DEBUG _CrtMemState oldstate; #endif int main() { _CrtMemDumpStatistics(&oldstate); std::cout << "Total count " << oldstate.lTotalCount; // C2065 // Fix by guarding references the same way as the declaration: // #ifdef _DEBUG // std::cout << "Total count " << oldstate.lTotalCount; // #endif }
Example: C++/CLI type deduction failure
This error can occur when calling a generic function, if the intended type argument can’t be deduced from the parameters used. For more information, see Generic Functions (C++/CLI).
// C2065_b.cpp // compile with: cl /clr C2065_b.cpp generic <typename ItemType> void G(int i) {} int main() { // global generic function call G<T>(10); // C2065 G<int>(10); // OK - fix with a specific type argument }
Example: C++/CLI attribute parameters
This error can also be generated as a result of compiler conformance work that was done for Visual Studio 2005: parameter checking for Visual C++ attributes.
// C2065_attributes.cpp // compile with: cl /c /clr C2065_attributes.cpp [module(DLL, name=MyLibrary)]; // C2065 // try the following line instead // [module(dll, name="MyLibrary")]; [export] struct MyStruct { int i; };
Содержание
- Ошибка компилятора C2065
- Идентификатор является необъявленным
- Пример: идентификатор с ошибками
- Пример. Использование несеченного идентификатора
- Пример: предварительно скомпилированные заголовки не первый
- Пример: отсутствующий файл заголовка
- Пример: отсутствует закрывающая цитата
- Пример. Использование итератора вне для области цикла
- Пример: объявление препроцессора удалено
- Пример: Сбой вычета типа C++/CLI
- Пример. Параметры атрибута C++/CLI
- Compiler Error C2065
- The identifier is undeclared
- Example: misspelled identifier
- Example: use an unscoped identifier
- Example: precompiled header isn’t first
- Example: missing header file
- Example: missing closing quote
- Example: use iterator outside for loop scope
- Example: preprocessor removed declaration
- Example: C++/CLI type deduction failure
- Example: C++/CLI attribute parameters
- Visual studio 2013 error c2065
- Answered by:
- Question
- Answers
Ошибка компилятора C2065
Компилятор не может найти объявление для идентификатора. Эта ошибка имеет несколько возможных причин. Наиболее распространенные причины C2065 : идентификатор не был объявлен, идентификатор написан с ошибками, заголовок, в котором объявлен идентификатор, не включен в файл, или в идентификаторе отсутствует квалификатор области, например, cout вместо std::cout . Дополнительные сведения о объявлениях в C++ см. в разделе Объявления и определения (C++).
Ниже приведены некоторые распространенные проблемы и их решения.
Идентификатор является необъявленным
Если идентификатор является переменной или именем функции, его необходимо объявить, прежде чем его можно будет использовать. Объявление функции должно также включать типы ее параметров, прежде чем можно будет использовать функцию. Если переменная объявлена с помощью auto , компилятор должен иметь возможность определить тип из инициализатора.
Если идентификатор является членом класса или структуры или объявлен в пространстве имен, он должен быть квалифицирован по имени класса или структуры или имени пространства имен при использовании за пределами области структуры, класса или пространства имен. Кроме того, пространство имен должно быть передано в область с помощью using директивы, например using namespace std; , или имя члена должно быть передано в область с помощью using объявления, например using std::string; . В противном случае непроверенное имя считается необъявленным идентификатором в текущей области.
Если идентификатор является тегом для определяемого пользователем class типа, например или struct , тип тега необходимо объявить, прежде чем его можно будет использовать. Например, объявление struct SomeStruct < /*. */ >; должно существовать, прежде чем можно будет объявить переменную SomeStruct myStruct; в коде.
Если идентификатор является псевдонимом типа, тип должен быть объявлен объявлением using или typedef перед его использованием. Например, необходимо объявить using my_flags = std::ios_base::fmtflags; перед использованием my_flags в качестве псевдонима типа для std::ios_base::fmtflags .
Пример: идентификатор с ошибками
Эта ошибка обычно возникает, если имя идентификатора написано с ошибкой или идентификатор использует неправильные прописные и строчные буквы. Имя в объявлении должно точно соответствовать используемому имени.
Пример. Использование несеченного идентификатора
Эта ошибка может возникнуть, если область действия идентификатора не задана должным образом. Если при использовании cout отображается C2065 , причина заключается в проблеме области. Если функции и операторы стандартной библиотеки C++ не полностью определяются пространством имен или вы не включили std пространство имен в текущую using область с помощью директивы , компилятор не сможет найти их. Чтобы устранить эту проблему, необходимо либо полностью указать имена идентификаторов, либо указать пространство имен с помощью директивы using .
В этом примере не удается выполнить компиляцию, так как cout и endl определены в std пространстве имен:
Идентификаторы, объявленные в типах class , struct или enum class , также должны быть квалифицированы по имени включающей области при их использовании за пределами этой области.
Пример: предварительно скомпилированные заголовки не первый
Эта ошибка может возникнуть, если перед файлом предварительно скомпилированного файла заголовка были помещены директивы препроцессора, например #include , #define или #pragma . #include Если исходный файл использует предварительно скомпилированный файл заголовка (то есть, если он компилируется с помощью /Yu параметра компилятора), то все директивы препроцессора, предшествующие предварительно скомпилированному файлу заголовка, игнорируются.
В этом примере не удается выполнить компиляцию, так как cout и endl определены в заголовке , который игнорируется, так как он включен перед предварительно скомпилированным файлом заголовка. Чтобы выполнить сборку этого примера, создайте все три файла, затем скомпилируйте pch.h (в некоторых версиях Visual Studio используется stdafx.cpp ), а затем скомпилируйте C2065_pch.cpp .
Исходный pch.h файл или stdafx.h :
Исходный файл C2065_pch.cpp :
Чтобы устранить эту проблему, добавьте #include в файл предкомпилированного заголовка или переместите его после включения предварительно скомпилированного файла заголовка в исходный файл.
Пример: отсутствующий файл заголовка
Ошибка может возникнуть, если вы не включили файл заголовка, в который объявляется идентификатор. Убедитесь, что файл, содержащий объявление идентификатора, включен в каждый исходный файл, в котором он используется.
Другой возможной причиной является использование списка инициализаторов без включения заголовка .
Эта ошибка может возникнуть в исходных файлах классического приложения Для Windows, если вы определяете VC_EXTRALEAN , WIN32_LEAN_AND_MEAN или WIN32_EXTRA_LEAN . Эти макросы препроцессора исключают некоторые файлы заголовков из windows.h и afxv_w32.h для ускорения компиляции. Найдите в windows.h и afxv_w32.h актуальное описание того, что исключается.
Пример: отсутствует закрывающая цитата
Эта ошибка может возникнуть, если отсутствует закрывающая кавычка после строковой константы. Это простой способ запутать компилятор. Отсутствующие закрывающие кавычки могут находиться в нескольких строках перед сообщаемой ошибкой.
Пример. Использование итератора вне для области цикла
Эта ошибка может возникнуть, если объявить переменную итератора в for цикле, а затем попытаться использовать эту переменную итератора вне области for цикла. Компилятор включает параметр компилятора /Zc:forScope по умолчанию. Дополнительные сведения см. в разделе Поддержка итератора отладки.
Пример: объявление препроцессора удалено
Эта ошибка может возникнуть, если вы ссылаетесь на функцию или переменную, которая находится в условно скомпилированном коде, который не компилируется для текущей конфигурации. Эта ошибка также может возникнуть при вызове функции в файле заголовка, которая в настоящее время не поддерживается в среде сборки. Если определенные переменные или функции доступны только при определении определенного макроса препроцессора, убедитесь, что код, вызывающий эти функции, может быть скомпилирован только при определении того же макроса препроцессора. Эту проблему легко обнаружить в интегрированной среде разработки: объявление для функции неактивно, если необходимые макросы препроцессора не определены для текущей конфигурации сборки.
Ниже приведен пример кода, который работает при сборке в отладке, но не в выпуске:
Пример: Сбой вычета типа C++/CLI
Эта ошибка может возникнуть при вызове универсальной функции, если предполагаемый аргумент типа не может быть выведен из используемых параметров. Дополнительные сведения см. в разделе Универсальные функции (C++/CLI).
Пример. Параметры атрибута C++/CLI
Эта ошибка также может быть создана в результате работы компилятора по соответствунию, выполненной для Visual Studio 2005: проверка параметров для атрибутов Visual C++.
Источник
Compiler Error C2065
The compiler can’t find the declaration for an identifier. There are many possible causes for this error. The most common causes of C2065 are that the identifier hasn’t been declared, the identifier is misspelled, the header where the identifier is declared isn’t included in the file, or the identifier is missing a scope qualifier, for example, cout instead of std::cout . For more information on declarations in C++, see Declarations and Definitions (C++).
Here are some common issues and solutions in greater detail.
The identifier is undeclared
If the identifier is a variable or a function name, you must declare it before it can be used. A function declaration must also include the types of its parameters before the function can be used. If the variable is declared using auto , the compiler must be able to infer the type from its initializer.
If the identifier is a member of a class or struct, or declared in a namespace, it must be qualified by the class or struct name, or the namespace name, when used outside the struct, class, or namespace scope. Alternatively, the namespace must be brought into scope by a using directive such as using namespace std; , or the member name must be brought into scope by a using declaration, such as using std::string; . Otherwise, the unqualified name is considered to be an undeclared identifier in the current scope.
If the identifier is the tag for a user-defined type, for example, a class or struct , the type of the tag must be declared before it can be used. For example, the declaration struct SomeStruct < /*. */ >; must exist before you can declare a variable SomeStruct myStruct; in your code.
If the identifier is a type alias, the type must be declared by a using declaration or typedef before it can be used. For example, you must declare using my_flags = std::ios_base::fmtflags; before you can use my_flags as a type alias for std::ios_base::fmtflags .
Example: misspelled identifier
This error commonly occurs when the identifier name is misspelled, or the identifier uses the wrong uppercase and lowercase letters. The name in the declaration must exactly match the name you use.
Example: use an unscoped identifier
This error can occur if your identifier isn’t properly scoped. If you see C2065 when you use cout , a scope issue is the cause. When C++ Standard Library functions and operators aren’t fully qualified by namespace, or you haven’t brought the std namespace into the current scope by using a using directive, the compiler can’t find them. To fix this issue, you must either fully qualify the identifier names, or specify the namespace with the using directive.
This example fails to compile because cout and endl are defined in the std namespace:
Identifiers that are declared inside of class , struct , or enum class types must also be qualified by the name of their enclosing scope when you use them outside of that scope.
This error can occur if you put any preprocessor directives, such as #include , #define , or #pragma , before the #include of a precompiled header file. If your source file uses a precompiled header file (that is, if it’s compiled by using the /Yu compiler option) then all preprocessor directives before the precompiled header file are ignored.
This example fails to compile because cout and endl are defined in the header, which is ignored because it’s included before the precompiled header file. To build this example, create all three files, then compile pch.h (some versions of Visual Studio use stdafx.cpp ), then compile C2065_pch.cpp .
The pch.h or stdafx.h source file:
Source file C2065_pch.cpp :
To fix this issue, add the #include of into the precompiled header file, or move it after the precompiled header file is included in your source file.
The error can occur if you haven’t included the header file that declares the identifier. Make sure the file that contains the declaration for the identifier is included in every source file that uses it.
Another possible cause is if you use an initializer list without including the header.
You may see this error in Windows Desktop app source files if you define VC_EXTRALEAN , WIN32_LEAN_AND_MEAN , or WIN32_EXTRA_LEAN . These preprocessor macros exclude some header files from windows.h and afxv_w32.h to speed compiles. Look in windows.h and afxv_w32.h for an up-to-date description of what’s excluded.
Example: missing closing quote
This error can occur if you’re missing a closing quote after a string constant. It’s an easy way to confuse the compiler. The missing closing quote may be several lines before the reported error location.
Example: use iterator outside for loop scope
This error can occur if you declare an iterator variable in a for loop, and then you try to use that iterator variable outside the scope of the for loop. The compiler enables the /Zc:forScope compiler option by default. For more information, see Debug iterator support.
Example: preprocessor removed declaration
This error can occur if you refer to a function or variable that is in conditionally compiled code that isn’t compiled for your current configuration. The error can also occur if you call a function in a header file that currently isn’t supported in your build environment. If certain variables or functions are only available when a particular preprocessor macro is defined, make sure the code that calls those functions can only be compiled when the same preprocessor macro is defined. This issue is easy to spot in the IDE: The declaration for the function is greyed out if the required preprocessor macros aren’t defined for the current build configuration.
Here’s an example of code that works when you build in Debug, but not Release:
Example: C++/CLI type deduction failure
This error can occur when calling a generic function, if the intended type argument can’t be deduced from the parameters used. For more information, see Generic Functions (C++/CLI).
Example: C++/CLI attribute parameters
This error can also be generated as a result of compiler conformance work that was done for Visual Studio 2005: parameter checking for Visual C++ attributes.
Источник
Visual studio 2013 error c2065
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
![]()
Answered by:

Question


For project shown below, I get an error when declaring a stream.
Visual Studio 2013 (v120)
MFC in a Shared dll
error C2065 : ‘ss’ : undeclared identifier
I’ve also tried various #includes and using namespace std;
Answers


In all cases the declared stream, «ss» in this case, is highlighted in the error messages. I ran the VS installer in repair mode (error only with support for MS Office development) and the error persisted. I then created a project with No MFC libraries, and it worked OK. Do you know if this is expected behavior? I don’t want to play around with this too long, but I don’t want to find out down the line that some other standard C++ code won’t compile.
Yes, but which line of code does the error message relate to? Just guessing, but it might seem that ss is being used in a different scope from where it was declared.
What do you mean by «I then created a project with No MFC libraries, and it worked OK»? is not an MFC library file.
I assure you that VS2013 allows use of all of the C++ library, with or without MFC.
Источник
I am new to windows programming, I was trying to compile the following code and it gives me the following errors:
C:Program FilesMicrosoft Visual StudioMyProjectshookhook.cpp(14) : error C2065: ‘KeyboardProc’ : undeclared identifier
C:Program FilesMicrosoft Visual StudioMyProjectshookhook.cpp(22) : error C2373: ‘KeyboardProc’ : redefinition; different type modifiers
C:Program FilesMicrosoft Visual StudioMyProjectshookhook.cpp(30) : error C2065: ‘GetkeyState’ : undeclared identifier
Error executing cl.exe.
/* CODE */
#include<windows.h>
static HHOOK hkb=NULL;
HANDLE h;
BOOL __stdcall DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
h=hModule;
return TRUE;
}
BOOL __declspec(dllexport)installhook()
{
hkb=SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, (HINSTANCE)h,0);
if(hkb==NULL)
return FALSE;
return TRUE;
}
LRESULT __declspec(dllexport)__stdcall KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
short int state;
if(nCode<0)
return CallNextHookEx(hkb, nCode, wParam, lParam);
if((nCode==HC_ACTION)&&((DWORD)lParam&0*40000000))
{
state=GetkeyState(VK_CAPITAL);
if((state&1)==0)
{
keybd_event(VK_CAPITAL,0,KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_CAPITAL,0,KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP,0);
}
}
return CallNextHookEx(hkb, nCode, wParam, lParam);
}
BOOL __declspec(dllexport) removehook()
{
return UnhookWindowsHookEx(hkb);
}
Can anyone please help me…
|
yk92 0 / 0 / 2 Регистрация: 28.02.2010 Сообщений: 35 |
||||
|
1 |
||||
|
07.11.2010, 20:35. Показов 106767. Ответов 35 Метки нет (Все метки)
видаёт мне такую ошибку:
__________________
0 |
|
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
07.11.2010, 20:35 |
|
35 |
|
Ignat 1260 / 798 / 108 Регистрация: 16.09.2009 Сообщений: 2,010 |
||||
|
07.11.2010, 22:38 |
2 |
|||
|
Надо сначала подключить Stdafx, а уже потом iostream, короче говоря поменять местами строки.
6 |
|
vaselo 19 / 19 / 5 Регистрация: 17.10.2010 Сообщений: 247 |
||||
|
07.11.2010, 23:40 |
3 |
|||
в вижуале он почему-то требует вот такого описания. Может ты еще и фигурную скобку не открыл?
0 |
|
M128K145
8376 / 3598 / 419 Регистрация: 03.07.2009 Сообщений: 10,708 |
||||
|
08.11.2010, 11:02 |
4 |
|||
|
vaselo, уже есть
а избыточность ни к чему. Правильный ответ во втором посте
0 |
|
Antariya 0 / 0 / 0 Регистрация: 08.06.2011 Сообщений: 4 |
||||||||
|
08.06.2011, 23:23 |
5 |
|||||||
|
А что делать в 10й висуал студо(экспресс)?
не помогает. (Либерти, упражнение 2, день 1)
0 |
|
593 / 531 / 76 Регистрация: 22.03.2011 Сообщений: 1,585 |
|
|
08.06.2011, 23:43 |
6 |
|
Antariya,
не помогает. а вот это странно
0 |
|
8376 / 3598 / 419 Регистрация: 03.07.2009 Сообщений: 10,708 |
|
|
09.06.2011, 00:13 |
7 |
|
Antariya, а мне кажется, что кто-то пытается нас обмануть. При том коде, который сейчас должны вылетать две ошибки:
0 |
|
0 / 0 / 0 Регистрация: 08.06.2011 Сообщений: 4 |
|
|
09.06.2011, 12:40 |
8 |
|
OstapBender, именно как в книге написала. Попробовала исправить.
0 |
|
3096 / 2415 / 257 Регистрация: 11.03.2009 Сообщений: 5,455 |
|
|
09.06.2011, 12:49 |
9 |
|
Таки сложно следить за изменениями, было бы лучше выкладывать текуший вариант программы вместе с его ошибками.
0 |
|
Antariya 0 / 0 / 0 Регистрация: 08.06.2011 Сообщений: 4 |
||||
|
09.06.2011, 12:51 |
10 |
|||
|
kazak, А. Точно. Извиняюсь.
warning C4067: непредвиденные лексемы за директивой препроцессора, требуется newline
0 |
|
diagon Higher 1953 / 1219 / 120 Регистрация: 02.05.2010 Сообщений: 2,925 Записей в блоге: 2 |
||||
|
09.06.2011, 12:53 |
11 |
|||
После #include <iostream> не надо точку с запятой
1 |
|
kazak 3096 / 2415 / 257 Регистрация: 11.03.2009 Сообщений: 5,455 |
||||||||
|
09.06.2011, 12:54 |
12 |
|||||||
|
endl в отдельности не используется, end вообще не существует.
1 |
|
0 / 0 / 0 Регистрация: 08.06.2011 Сообщений: 4 |
|
|
09.06.2011, 13:44 |
13 |
|
kazak, diagon, всё получилось, огромное спасибо.
0 |
|
Oleg35 0 / 0 / 0 Регистрация: 26.01.2011 Сообщений: 8 |
||||
|
30.10.2012, 19:41 |
14 |
|||
|
Здравствуйте, а можете мне помочь?
выдает (при отладке) (Урок 2- http://data.com1.ru/prog-schoo… esson2.mp4 Visual 08-Упрощенная(тоесть только для C++)
0 |
|
M128K145
8376 / 3598 / 419 Регистрация: 03.07.2009 Сообщений: 10,708 |
||||
|
30.10.2012, 20:56 |
15 |
|||
|
Oleg35, используйте std::cout, std::cin и std::endl или после инклудов напишите
Первый вариант предпочтительнее
0 |
|
Мой лучший друг-отладчик! 166 / 166 / 30 Регистрация: 24.06.2012 Сообщений: 662 Записей в блоге: 5 |
|
|
30.10.2012, 22:09 |
16 |
|
M128K145, в ходе обучения использование using namespace std; вместо std:: способствует, как мне кажется, лучшему восприятию кода.И на ранних этапах обучения программированию использвание пространства предпочтительнее. Но с другой стороны, в профессиональном программировании, насколько я знаю, юзать нужно только std::.Мне тут все модеры это твердили.И уже за собой тоже заметил — постоянно пишу std:: вместо namespace
0 |
|
8376 / 3598 / 419 Регистрация: 03.07.2009 Сообщений: 10,708 |
|
|
30.10.2012, 23:20 |
17 |
|
M128K145, в ходе обучения использование using namespace std; вместо std:: способствует, как мне кажется, лучшему восприятию кода.И на ранних этапах обучения программированию использвание пространства предпочтительнее. если постоянно привыкать спать на потолке(ну как начинающий), то со временем вы уже с трудом сможете переучится спать как и все люди — на диване, который стоит на полу и то, если захочется
0 |
|
0 / 0 / 0 Регистрация: 26.01.2011 Сообщений: 8 |
|
|
31.10.2012, 15:09 |
18 |
|
Вставил не помогло, теперь выдает это
0 |
|
Мой лучший друг-отладчик! 166 / 166 / 30 Регистрация: 24.06.2012 Сообщений: 662 Записей в блоге: 5 |
|
|
31.10.2012, 15:14 |
19 |
|
Нет в С++ оператора end!!!Есть endl.
1 |
|
0 / 0 / 0 Регистрация: 26.01.2011 Сообщений: 8 |
|
|
31.10.2012, 15:21 |
20 |
|
Ура, спасибо большое. Вот оказывается где собака была зарыта.
0 |

