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

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler Error C3861

Compiler Error C3861

06/29/2022

C3861

C3861

0a1eee30-b3db-41b1-b1e5-35949c3924d7

Compiler Error C3861

identifier‘: identifier not found

The compiler was unable to resolve a reference to an identifier, even using argument-dependent lookup.

Remarks

To fix this error, compare use of identifier to the identifier declaration for case and spelling. Verify that scope resolution operators and namespace using directives are used correctly. If the identifier is declared in a header file, verify that the header is included before the identifier is referenced. If the identifier is meant to be externally visible, make sure that it’s declared in any source file that uses it. Also check that the identifier declaration or definition isn’t excluded by conditional compilation directives.

Changes to remove obsolete functions from the C Runtime Library in Visual Studio 2015 can cause C3861. To resolve this error, remove references to these functions or replace them with their secure alternatives, if any. For more information, see Obsolete functions.

If error C3861 appears after project migration from older versions of the compiler, you may have issues related to supported Windows versions. Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, Windows NT or Windows 2000. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. For more information, see Modifying WINVER and _WIN32_WINNT.

Examples

Undefined identifier

The following sample generates C3861 because the identifier isn’t defined.

// C3861.cpp
void f2(){}
int main() {
   f();    // C3861
   f2();   // OK
}

Identifier not in scope

The following sample generates C3861, because an identifier is only visible in the file scope of its definition, unless it’s declared in other source files that use it.

Source file C3861_a1.cpp:

// C3861_a1.cpp
// Compile with: cl /EHsc /W4 C3861_a1.cpp C3861_a2.cpp
#include <iostream>
// Uncomment the following line to fix:
// int f();  // declaration makes external function visible
int main() {
   std::cout << f() << std::endl;    // C3861
}

Source file C3861_a2.cpp:

// C3861_a2.cpp
int f() {  // declared and defined here
   return 42;
}

Namespace qualification required

Exception classes in the C++ Standard Library require the std namespace.

// C3861_b.cpp
// compile with: /EHsc
#include <iostream>
int main() {
   try {
      throw exception("Exception");   // C3861
      // try the following line instead
      // throw std::exception("Exception");
   }
   catch (...) {
      std::cout << "caught an exception" << std::endl;
   }
}

Obsolete function called

Obsolete functions have been removed from the CRT library.

// C3861_c.cpp
#include <stdio.h>
int main() {
   char line[21]; // room for 20 chars + ''
   gets( line );  // C3861
   // Use gets_s instead.
   printf( "The line entered was: %sn", line );
}

ADL and friend functions

The following sample generates C3767 because the compiler can’t use argument dependent lookup for FriendFunc:

namespace N {
   class C {
      friend void FriendFunc() {}
      friend void AnotherFriendFunc(C* c) {}
   };
}

int main() {
   using namespace N;
   FriendFunc();   // C3861 error
   C* pC = new C();
   AnotherFriendFunc(pC);   // found via argument-dependent lookup
}

To fix the error, declare the friend in class scope and define it in namespace scope:

class MyClass {
   int m_private;
   friend void func();
};

void func() {
   MyClass s;
   s.m_private = 0;
}

int main() {
   func();
}

I have a problem with my code. Unfortunately, when compiling I get these errors all the time. What can this be caused by and how to fix it?

error C3861: ‘print’: identifier not found

My code:

main.cpp

#include "pojazdy.h"
#include <iostream>

using namespace std;

int main()
{
    Pojazdy** poj;
    int size{ 0 }, index{ 0 };
    Petla(poj, size);

    print(poj, size);

    wyrejestruj(poj,size,0);
    print(poj, size);
    wyrejestruj(poj,size);

    return 0;
}

pojazdy.h

#ifndef pojazdy_h
#define pojazdy_h

#include <iostream>
#include <cstdlib>

using namespace std;

class Pojazdy
{
public:
    string typ;
    string marka;
    string model;
    string z_dod;
    int ilosc;
    int cena;

    void dodaj();
    void d_pojazd(Pojazdy**& pojazdy, int& size);
    void wyrejestruj(Pojazdy**& pojazdy, int& size, int index);
    void print(Pojazdy** pojazdy, int size);
    void Petla(Pojazdy**& p, int& size);

    //void wyswietl();
    int get_ilosc() { return ilosc; }
    string get_typ() { return typ; }
    string get_marka() { return marka; }
    string get_model() { return model; }
    int get_cena() { return cena; }
    void set_ilosc(int x);
};

#endif

pojazdy.cpp

#include "pojazdy.h"

#include <iostream>

using namespace std;

void Pojazdy::set_ilosc(int x) { ilosc = x; }

void Pojazdy::dodaj()
{
    cout << "DODAWANIE POJAZDU..." << endl;
    cout << "Podaj typ pojazdu:";
    cin >> typ;

    cout << "Podaj marke pojazdu: ";
    cin >> marka;

    cout << "Podaj model pojazdu: ";
    cin >> model;

    cout << "Dodaj cene pojazdu: ";
    cin >> cena;
}

void Petla(Pojazdy**& p, int& size) {
    char z_dod;// = 'N';
    do {
        d_pojazd(p, size); //odpowiada za dodawnie
        p[size - 1]->dodaj();
        cout << "Czy chcesz zakonczyc dodawanie? Jesli tak, wcisnij Y/N: ";
        cin >> z_dod;

    } while (z_dod == 'N' || z_dod == 'n');//while (p[size]->z_dod == "N" ||p[size]->z_dod == "n");
}

void print(Pojazdy** pojazdy, int size) {
    std::cout << "====================================" << std::endl;
    for (int i{ 0 }; i < size; i++)
        std::cout << "Typ: " << pojazdy[i]->get_typ() << " Marka: " << pojazdy[i]->get_marka() << " Model: " << pojazdy[i]->get_model() << " Cena: " << pojazdy[i]->get_model() << std::endl;
}

void wyrejestruj(Pojazdy**& pojazdy, int& size) {
    for (size_t i{ 0 }; i < size; i++)
        delete pojazdy[i];
    delete[] pojazdy;
    size = 0;
    pojazdy = NULL;
}

void wyrejestruj(Pojazdy**& pojazdy, int& size, int index) {
    if (index < size) {
        Pojazdy** temp = new Pojazdy * [size - 1];
        short int j{ -1 };
        for (size_t i{ 0 }; i < size; i++) {
            if (i != index) {
                j++;
                temp[j] = pojazdy[i];
            }
        }
        delete[] pojazdy;
        --size;
        pojazdy = temp;
    }
    else
        std::cout << "Pamiec zwolniona!" << std::endl;
}

void d_pojazd(Pojazdy**& pojazdy, int& size) {
    Pojazdy** temp = new Pojazdy * [size + 1];
    if (size == 0)
        temp[size] = new Pojazdy;
    else {
        for (int i{ 0 }; i < size; i++)
            temp[i] = pojazdy[i];
        delete[] pojazdy;

        temp[size] = new Pojazdy;
    }
    ++size;
    pojazdy = temp;
}

I used #ifndef, #define, #endif and #pragma once, but none of them work. I will be really grateful for every code, I am already tired of this second hour. And forgive the non-English variables and function names for them — it’s university code, so I didn’t feel the need.

01.04.2016, 22:52. Показов 42002. Ответов 2


Студворк — интернет-сервис помощи студентам

Не суть важен текст программы, как то, что у меня не получается подключить функции.
Выдает ошибку:
С3861 «название функции»: идентификатор не найден

Подскажите, пожалуйста, что делать.
Вот что я нашел:
]identifier: идентификатор не найден
Компилятору не удалось разрешить ссылку на идентификатор даже при поиске с зависимостью от аргументов.
Чтобы устранить эту ошибку, проверьте написание и регистр объявления идентификатора. Убедитесь, что операторы разрешения области действия и директивы using пространства имен используются правильно. Если идентификатор объявляется в файле заголовка, убедитесь, что заголовок включен до ссылки на него. Кроме того, убедитесь, что идентификатор не исключен с помощью директив условной компиляции.

Но, честно говоря, не особо понял что надобно делать.
Может, я что-то не подключил?

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

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <conio.h>
#include <math.h>
using namespace std;
 
void main()
{
    setlocale(LC_ALL, "Russian");
    int n, p;
    double **a = NULL;
    double **b = NULL;
    double **c = NULL;
    double **a1 = NULL;
    double **b1 = NULL;
    cout << "Введите размерность массива (число n): ";
    cin >> n;
    NewMemory(a, n);
    NewMemory(b, n);
    NewMemory(c, n);
    NewMemory(a1, n);
    NewMemory(b1, n);
 
    do
        {
            system("cls");
            cout << "1. Создание матрицы a " << endl;
            cout << "2. Создание матрицы b " << endl;
            cout << "3. Нахождение m-нормы матрицы a" << endl;
            cout << "4. Умножение матрицы B на число (b1= b*am)" << endl;
            cout << "5. Вычитание матриц(a1=a-b1)" << endl;
            cout << "6. Обращение матрицы( с=a1^(-1)" << endl;
            cout << "7. Вывод всех матриц(a, a1, b, b1, c)" << endl;
            cout << "8. Конец работы" << endl << endl;
            cout << "Укажите пункт меню: ";
            cin >> p;
            switch (p) 
            {
            case 1: AarrayCreator(a, n);
                break;
            case 2:
                break;
            case 3:
                break;
            case 4:
                break;
            case 5:
                break;
            case 6:
                break;
            case 7:
                break;
            case 8:
                DeleteArray(a, n);
                DeleteArray(b, n);
                DeleteArray(c, n);
                DeleteArray(a1, n);
                DeleteArray(b1, n);
                return;
            }
            _getch();
        } while (true);
    system("Pause");
}
 
 
void NewMemory(double **&h, int n)
{
    h = new double* [n];
    for (int i = 0; i < 2; i++)
        h[i] = new double[n];
}
 
void DeleteArray(double **&h, int n)
{
    for (int i = 0; i < n; i++)
        delete[] h[i];
}
 
double AarrayCreator(double **h, int n) {
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            h[i][j] = (sin(i + j))*sin(i + j);
}

P.S. я не знаю насколько правильный весь код. Сразу извиняюсь за корявость
P.S.S Ошибку он мне выдает на каждое объявление функции. Всех функций



0



  • Remove From My Forums
  • Question

  • I am trying to determine whether a specific string is included in a list by using «find» in c++. However, whenever I try to compile the following code, the compiler returns «error C3861: ‘find’: identifier not found.» I am unsure of where I am going wrong.
    I would appreciate if someone could either point out why «find» will not work as written or provide and alternative method for determining how to determine if a variable is not in a list.

    Thanks

    #include <iostream>
    #include <string>
    
    #include <list>
    
    using namespace std;
    
    int main()
    {
    	string myString[] = {"text1","text2","text3"};
    	list<string> myList(&myString[0],&myString[2]);
    
    	string myInput;
    	cout << "What string do you want to check? ";
    	cin >> myInput;
    
    	if (find(myList.begin(),myList.end(),myInput) != myList.end())
    	{
    		cout << "Not found in list";
    	}
    	return 0;
    }
    

Answers

  • PrestonBR wrote:

    I am trying to determine whether a specific string is included in a  list by using «find» in c++. However, whenever I try to
    compile the following code, the compiler returns «error C3861: ‘find’:  identifier not found.»

    #include <algorithm>


    Igor Tandetnik

    • Marked as answer by

      Sunday, January 1, 2012 5:09 PM

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler Error C3861

Compiler Error C3861

06/29/2022

C3861

C3861

0a1eee30-b3db-41b1-b1e5-35949c3924d7

Compiler Error C3861

identifier‘: identifier not found

The compiler was unable to resolve a reference to an identifier, even using argument-dependent lookup.

Remarks

To fix this error, compare use of identifier to the identifier declaration for case and spelling. Verify that scope resolution operators and namespace using directives are used correctly. If the identifier is declared in a header file, verify that the header is included before the identifier is referenced. If the identifier is meant to be externally visible, make sure that it’s declared in any source file that uses it. Also check that the identifier declaration or definition isn’t excluded by conditional compilation directives.

Changes to remove obsolete functions from the C Runtime Library in Visual Studio 2015 can cause C3861. To resolve this error, remove references to these functions or replace them with their secure alternatives, if any. For more information, see Obsolete functions.

If error C3861 appears after project migration from older versions of the compiler, you may have issues related to supported Windows versions. Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, Windows NT or Windows 2000. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. For more information, see Modifying WINVER and _WIN32_WINNT.

Examples

Undefined identifier

The following sample generates C3861 because the identifier isn’t defined.

// C3861.cpp
void f2(){}
int main() {
   f();    // C3861
   f2();   // OK
}

Identifier not in scope

The following sample generates C3861, because an identifier is only visible in the file scope of its definition, unless it’s declared in other source files that use it.

Source file C3861_a1.cpp:

// C3861_a1.cpp
// Compile with: cl /EHsc /W4 C3861_a1.cpp C3861_a2.cpp
#include <iostream>
// Uncomment the following line to fix:
// int f();  // declaration makes external function visible
int main() {
   std::cout << f() << std::endl;    // C3861
}

Source file C3861_a2.cpp:

// C3861_a2.cpp
int f() {  // declared and defined here
   return 42;
}

Namespace qualification required

Exception classes in the C++ Standard Library require the std namespace.

// C3861_b.cpp
// compile with: /EHsc
#include <iostream>
int main() {
   try {
      throw exception("Exception");   // C3861
      // try the following line instead
      // throw std::exception("Exception");
   }
   catch (...) {
      std::cout << "caught an exception" << std::endl;
   }
}

Obsolete function called

Obsolete functions have been removed from the CRT library.

// C3861_c.cpp
#include <stdio.h>
int main() {
   char line[21]; // room for 20 chars + ''
   gets( line );  // C3861
   // Use gets_s instead.
   printf( "The line entered was: %sn", line );
}

ADL and friend functions

The following sample generates C3767 because the compiler can’t use argument dependent lookup for FriendFunc:

namespace N {
   class C {
      friend void FriendFunc() {}
      friend void AnotherFriendFunc(C* c) {}
   };
}

int main() {
   using namespace N;
   FriendFunc();   // C3861 error
   C* pC = new C();
   AnotherFriendFunc(pC);   // found via argument-dependent lookup
}

To fix the error, declare the friend in class scope and define it in namespace scope:

class MyClass {
   int m_private;
   friend void func();
};

void func() {
   MyClass s;
   s.m_private = 0;
}

int main() {
   func();
}
description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler Error C3861

Compiler Error C3861

06/29/2022

C3861

C3861

0a1eee30-b3db-41b1-b1e5-35949c3924d7

Compiler Error C3861

identifier‘: identifier not found

The compiler was unable to resolve a reference to an identifier, even using argument-dependent lookup.

Remarks

To fix this error, compare use of identifier to the identifier declaration for case and spelling. Verify that scope resolution operators and namespace using directives are used correctly. If the identifier is declared in a header file, verify that the header is included before the identifier is referenced. If the identifier is meant to be externally visible, make sure that it’s declared in any source file that uses it. Also check that the identifier declaration or definition isn’t excluded by conditional compilation directives.

Changes to remove obsolete functions from the C Runtime Library in Visual Studio 2015 can cause C3861. To resolve this error, remove references to these functions or replace them with their secure alternatives, if any. For more information, see Obsolete functions.

If error C3861 appears after project migration from older versions of the compiler, you may have issues related to supported Windows versions. Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, Windows NT or Windows 2000. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. For more information, see Modifying WINVER and _WIN32_WINNT.

Examples

Undefined identifier

The following sample generates C3861 because the identifier isn’t defined.

// C3861.cpp
void f2(){}
int main() {
   f();    // C3861
   f2();   // OK
}

Identifier not in scope

The following sample generates C3861, because an identifier is only visible in the file scope of its definition, unless it’s declared in other source files that use it.

Source file C3861_a1.cpp:

// C3861_a1.cpp
// Compile with: cl /EHsc /W4 C3861_a1.cpp C3861_a2.cpp
#include <iostream>
// Uncomment the following line to fix:
// int f();  // declaration makes external function visible
int main() {
   std::cout << f() << std::endl;    // C3861
}

Source file C3861_a2.cpp:

// C3861_a2.cpp
int f() {  // declared and defined here
   return 42;
}

Namespace qualification required

Exception classes in the C++ Standard Library require the std namespace.

// C3861_b.cpp
// compile with: /EHsc
#include <iostream>
int main() {
   try {
      throw exception("Exception");   // C3861
      // try the following line instead
      // throw std::exception("Exception");
   }
   catch (...) {
      std::cout << "caught an exception" << std::endl;
   }
}

Obsolete function called

Obsolete functions have been removed from the CRT library.

// C3861_c.cpp
#include <stdio.h>
int main() {
   char line[21]; // room for 20 chars + ''
   gets( line );  // C3861
   // Use gets_s instead.
   printf( "The line entered was: %sn", line );
}

ADL and friend functions

The following sample generates C3767 because the compiler can’t use argument dependent lookup for FriendFunc:

namespace N {
   class C {
      friend void FriendFunc() {}
      friend void AnotherFriendFunc(C* c) {}
   };
}

int main() {
   using namespace N;
   FriendFunc();   // C3861 error
   C* pC = new C();
   AnotherFriendFunc(pC);   // found via argument-dependent lookup
}

To fix the error, declare the friend in class scope and define it in namespace scope:

class MyClass {
   int m_private;
   friend void func();
};

void func() {
   MyClass s;
   s.m_private = 0;
}

int main() {
   func();
}

I have a problem with my code. Unfortunately, when compiling I get these errors all the time. What can this be caused by and how to fix it?

error C3861: ‘print’: identifier not found

My code:

main.cpp

#include "pojazdy.h"
#include <iostream>

using namespace std;

int main()
{
    Pojazdy** poj;
    int size{ 0 }, index{ 0 };
    Petla(poj, size);

    print(poj, size);

    wyrejestruj(poj,size,0);
    print(poj, size);
    wyrejestruj(poj,size);

    return 0;
}

pojazdy.h

#ifndef pojazdy_h
#define pojazdy_h

#include <iostream>
#include <cstdlib>

using namespace std;

class Pojazdy
{
public:
    string typ;
    string marka;
    string model;
    string z_dod;
    int ilosc;
    int cena;

    void dodaj();
    void d_pojazd(Pojazdy**& pojazdy, int& size);
    void wyrejestruj(Pojazdy**& pojazdy, int& size, int index);
    void print(Pojazdy** pojazdy, int size);
    void Petla(Pojazdy**& p, int& size);

    //void wyswietl();
    int get_ilosc() { return ilosc; }
    string get_typ() { return typ; }
    string get_marka() { return marka; }
    string get_model() { return model; }
    int get_cena() { return cena; }
    void set_ilosc(int x);
};

#endif

pojazdy.cpp

#include "pojazdy.h"

#include <iostream>

using namespace std;

void Pojazdy::set_ilosc(int x) { ilosc = x; }

void Pojazdy::dodaj()
{
    cout << "DODAWANIE POJAZDU..." << endl;
    cout << "Podaj typ pojazdu:";
    cin >> typ;

    cout << "Podaj marke pojazdu: ";
    cin >> marka;

    cout << "Podaj model pojazdu: ";
    cin >> model;

    cout << "Dodaj cene pojazdu: ";
    cin >> cena;
}

void Petla(Pojazdy**& p, int& size) {
    char z_dod;// = 'N';
    do {
        d_pojazd(p, size); //odpowiada za dodawnie
        p[size - 1]->dodaj();
        cout << "Czy chcesz zakonczyc dodawanie? Jesli tak, wcisnij Y/N: ";
        cin >> z_dod;

    } while (z_dod == 'N' || z_dod == 'n');//while (p[size]->z_dod == "N" ||p[size]->z_dod == "n");
}

void print(Pojazdy** pojazdy, int size) {
    std::cout << "====================================" << std::endl;
    for (int i{ 0 }; i < size; i++)
        std::cout << "Typ: " << pojazdy[i]->get_typ() << " Marka: " << pojazdy[i]->get_marka() << " Model: " << pojazdy[i]->get_model() << " Cena: " << pojazdy[i]->get_model() << std::endl;
}

void wyrejestruj(Pojazdy**& pojazdy, int& size) {
    for (size_t i{ 0 }; i < size; i++)
        delete pojazdy[i];
    delete[] pojazdy;
    size = 0;
    pojazdy = NULL;
}

void wyrejestruj(Pojazdy**& pojazdy, int& size, int index) {
    if (index < size) {
        Pojazdy** temp = new Pojazdy * [size - 1];
        short int j{ -1 };
        for (size_t i{ 0 }; i < size; i++) {
            if (i != index) {
                j++;
                temp[j] = pojazdy[i];
            }
        }
        delete[] pojazdy;
        --size;
        pojazdy = temp;
    }
    else
        std::cout << "Pamiec zwolniona!" << std::endl;
}

void d_pojazd(Pojazdy**& pojazdy, int& size) {
    Pojazdy** temp = new Pojazdy * [size + 1];
    if (size == 0)
        temp[size] = new Pojazdy;
    else {
        for (int i{ 0 }; i < size; i++)
            temp[i] = pojazdy[i];
        delete[] pojazdy;

        temp[size] = new Pojazdy;
    }
    ++size;
    pojazdy = temp;
}

I used #ifndef, #define, #endif and #pragma once, but none of them work. I will be really grateful for every code, I am already tired of this second hour. And forgive the non-English variables and function names for them — it’s university code, so I didn’t feel the need.

  • Remove From My Forums
  • Question

  • My C++ code compiles fine with VS 2013 but when I have compiled with VS 2015 I get this error:

    C:Program Files (x86)Microsoft Visual Studio 14.0VCatlmfcincludeatlwinverapi.h(710): error C3861: 'LCMapStringEx': identifier not found
    

    I don’t use LCMapString anywhere in my code, so I don’t know where this come from? Can you help me in resolving this error?

    • Moved by

      Wednesday, January 11, 2017 7:21 AM

Answers

    • Marked as answer by
      smhaneef
      Wednesday, January 11, 2017 2:40 PM

01.04.2016, 22:52. Показов 38070. Ответов 2


Не суть важен текст программы, как то, что у меня не получается подключить функции.
Выдает ошибку:
С3861 «название функции»: идентификатор не найден

Подскажите, пожалуйста, что делать.
Вот что я нашел:
]identifier: идентификатор не найден
Компилятору не удалось разрешить ссылку на идентификатор даже при поиске с зависимостью от аргументов.
Чтобы устранить эту ошибку, проверьте написание и регистр объявления идентификатора. Убедитесь, что операторы разрешения области действия и директивы using пространства имен используются правильно. Если идентификатор объявляется в файле заголовка, убедитесь, что заголовок включен до ссылки на него. Кроме того, убедитесь, что идентификатор не исключен с помощью директив условной компиляции.

Но, честно говоря, не особо понял что надобно делать.
Может, я что-то не подключил?

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

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <conio.h>
#include <math.h>
using namespace std;
 
void main()
{
    setlocale(LC_ALL, "Russian");
    int n, p;
    double **a = NULL;
    double **b = NULL;
    double **c = NULL;
    double **a1 = NULL;
    double **b1 = NULL;
    cout << "Введите размерность массива (число n): ";
    cin >> n;
    NewMemory(a, n);
    NewMemory(b, n);
    NewMemory(c, n);
    NewMemory(a1, n);
    NewMemory(b1, n);
 
    do
        {
            system("cls");
            cout << "1. Создание матрицы a " << endl;
            cout << "2. Создание матрицы b " << endl;
            cout << "3. Нахождение m-нормы матрицы a" << endl;
            cout << "4. Умножение матрицы B на число (b1= b*am)" << endl;
            cout << "5. Вычитание матриц(a1=a-b1)" << endl;
            cout << "6. Обращение матрицы( с=a1^(-1)" << endl;
            cout << "7. Вывод всех матриц(a, a1, b, b1, c)" << endl;
            cout << "8. Конец работы" << endl << endl;
            cout << "Укажите пункт меню: ";
            cin >> p;
            switch (p) 
            {
            case 1: AarrayCreator(a, n);
                break;
            case 2:
                break;
            case 3:
                break;
            case 4:
                break;
            case 5:
                break;
            case 6:
                break;
            case 7:
                break;
            case 8:
                DeleteArray(a, n);
                DeleteArray(b, n);
                DeleteArray(c, n);
                DeleteArray(a1, n);
                DeleteArray(b1, n);
                return;
            }
            _getch();
        } while (true);
    system("Pause");
}
 
 
void NewMemory(double **&h, int n)
{
    h = new double* [n];
    for (int i = 0; i < 2; i++)
        h[i] = new double[n];
}
 
void DeleteArray(double **&h, int n)
{
    for (int i = 0; i < n; i++)
        delete[] h[i];
}
 
double AarrayCreator(double **h, int n) {
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            h[i][j] = (sin(i + j))*sin(i + j);
}

P.S. я не знаю насколько правильный весь код. Сразу извиняюсь за корявость
P.S.S Ошибку он мне выдает на каждое объявление функции. Всех функций

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

0

На чтение 6 мин. Просмотров 93 Опубликовано 15.12.2019

«идентификатор«: идентификатор не найден ‘identifier‘: identifier not found

Компилятору не удалось разрешить ссылку на идентификатор даже при поиске с зависимостью от аргументов. The compiler was not able to resolve a reference to an identifier, even using argument-dependent lookup.

Содержание

  1. Примечания Remarks
  2. Примеры Examples
  3. Неопределенный идентификатор Undefined identifier
  4. Идентификатор не находится в области Identifier not in scope
  5. Требуется квалификации пространства имен Namespace qualification required
  6. Устаревшие функции с именем Obsolete function called
  7. ADL и дружественные функции ADL and friend functions
  8. Решение
  9. Другие решения
  10. 2 ответа 2

Чтобы устранить эту ошибку, сравните использование идентификатор на написание и регистр объявления идентификатора. To fix this error, compare use of identifier to the identifier declaration for case and spelling. Убедитесь, что операторов разрешения области и пространство имен директив using используются правильно. Verify that scope resolution operators and namespace using directives are used correctly. Если идентификатор объявлен в файле заголовка, убедитесь, что заголовок включен до ссылки на идентификатор. If the identifier is declared in a header file, verify that the header is included before the identifier is referenced. Если идентификатор должен быть видимый извне, убедитесь, что он объявлен в все файлы исходного кода, который его использует. If the identifier is meant to be externally visible, make sure that it is declared in any source file that uses it. Также проверьте, что идентификатор объявления или определения не исключен с директивы условной компиляции. Also check that the identifier declaration or definition is not excluded by conditional compilation directives.

Изменения, чтобы удалить устаревшие функции из библиотеки времени выполнения C в Visual Studio 2015 может привести к C3861. Changes to remove obsolete functions from the C Runtime Library in Visual Studio 2015 can cause C3861. Чтобы устранить эту ошибку, удалите ссылки на эти функции или замените их безопасных альтернатив, если таковые имеются. To resolve this error, remove references to these functions or replace them with their secure alternatives, if any. Дополнительные сведения см. в разделе устаревшие функции. For more information, see Obsolete Functions.

При появлении ошибки C3861 после миграции проекта из более старой версии компилятора, возможно, возникли проблемы, связанные с поддерживаемыми версиями Windows. If error C3861 appears after project migration from older versions of the compiler, you may have issues related to supported Windows versions. Visual C++ больше не поддерживает создание программ для Windows 95, Windows 98, Windows ME, Windows NT и Windows 2000. Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, Windows NT or Windows 2000. Если ваши макросы WINVER или _WIN32_WINNT предназначены для одной из этих версий Windows, необходимо изменить такие макросы. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. Дополнительные сведения см. в разделе изменение WINVER и _WIN32_WINNT. For more information, see Modifying WINVER and _WIN32_WINNT.

Примеры Examples

Неопределенный идентификатор Undefined identifier

Следующий пример приводит к возникновению ошибки C3861, так как идентификатор не определен. The following sample generates C3861 because the identifier is not defined.

Идентификатор не находится в области Identifier not in scope

Следующий пример приводит к возникновению ошибки C3861, так как идентификатор отображается в области видимости файла его определения, только в том случае, если она не объявлена в других исходных файлах, которые ее используют. The following sample generates C3861 because an identifier is only visible in the file scope of its definition, unless it is declared in other source files that use it.

Требуется квалификации пространства имен Namespace qualification required

Классы исключений в стандартной библиотеке C++ требует std пространства имен. Exception classes in the C++ Standard Library require the std namespace.

Устаревшие функции с именем Obsolete function called

Устаревшие функции были удалены из библиотеки CRT. Obsolete functions have been removed from the CRT library.

ADL и дружественные функции ADL and friend functions

В следующем примере возникает C3767, так как компилятор не может использовать поиск по аргументам для FriendFunc : The following sample generates C3767 because the compiler cannot use argument dependent lookup for FriendFunc :

Чтобы устранить эту ошибку, объявите friend в области видимости класса и определите его в области видимости пространства имен: To fix the error, declare the friend in class scope and define it in namespace scope:

У меня есть файл «HSlider.h», он использует «Draw.h», где я определил свои функции для их использования.
Но компилятор говорит, что я не определил их (идентификатор не найден). Я искал на форумах похожую ошибку, но это не помогло.

Я работаю в VS 2015 Communty.

ПРИМЕР ОШИБКИ:
Ошибка C3861 DrawGUIBox: идентификатор не найден
Try2 c: users lel Documents visual studio 2015 projects try2 try2 hslider.h 50
,

HSlider.h

Draw.h

Решение

Проблема не в вашем исходном коде. Проблема в том, что ваш файл решения Visual Studio (в указанной вами ссылке) поврежден. В файле решения есть ссылки на проект под названием Try2, но этот проект не существует в решении.

Чтобы это исправить, сделайте следующее.

Откройте файл Help.sln с помощью notepad ++, и вы увидите строку

Это означает, что должен быть подпроект под названием Try2, но он не существует. В вашем архиве субпроект фактически называется «Помощь». Итак, измените строку на:

После этого просмотрите папки x64 в своем решении и удалите все оставшиеся файлы, относящиеся к Try2.

ИЛИ, создайте новое пустое решение и скопируйте исходные файлы .cpp и .h (только) по одному в новое решение.

(Существует также отдельная проблема, когда отсутствует файл Offsets.h, но я не могу с этим помочь.)

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

Я нашел ответ сам.
Проблема была в круговом включении.
И это произошло потому, что я определил свои классы в файле заголовка вместо файла .cpp.
После этого и правильного перемещения заголовков я исправил это за считанные минуты.

Использую библиотеку math.h и в ней для нахождения кубического корня есть функция cbrt(); Только вот при компиляции Visual Studio говорит: error C3861: cbrt: идентификатор не найден.

Как решать проблему?

2 ответа 2

Правильно он споткнулся. Потому что эта функция находиться в другом заголовчном файле — amp_math.h (пруф).

Не знаю, с чем связано отсутствие этой функции, но попробуйте вот так:

Вообще cbrt есть в С99 и в C++TR1, который, кажется, как раз вошел в C++11. Ну а упрекнуть vc++ в хорошей поддержке этого стандарта до сих пор довольно трудно

Я только начал новый win32 консольное приложение в VS 2010 и установить Additional options собственность на precompiled headerв предстоящем мастере.

На основе один из моих предыдущих вопросов Я решил использовать следующий основной прототип:

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

Я также изменил Character Set свойство проекта к Use Multi-Byte Character Set,

Но следующий код:

system("pause");

Будет выдавать эти две ошибки:

error C3861: 'system': identifier not found
IntelliSense: identifier "system" is undefined

У меня был такой же опыт, и ошибок не было!
Кто-нибудь может подсказать мне, что не так?

2

Решение

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

В случае с system функция, это определено в stdlib.h заголовочный файл

Итак, в начало вашего файла кода (или в вашем предварительно скомпилированном заголовочном файле) добавьте строку

#include <stdlib.h>

(Вы используете угловые скобки вместо кавычек, потому что stdlib.h найден ли заголовок в том месте, о котором ранее сообщалось инструменту сборки; это включает в себя каталоги системных заголовков и другие каталоги, которые ваша конфигурация сборки специально требует.)

Помимо этого я сильно рекомендую против используя либо многобайтовый набор символов (все новые приложения Windows должны поддерживать Unicode), либо system функция, особенно system("pause"),

7

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

Для меня работало то, что #include "stdafx.h" был ПЕРВЫЙ ВКЛЮЧЕН в файл. Так #include <iostream> поэтому будет после этого.

Это решило проблему.

3

  • Forum
  • Beginners
  • Visual Studio 2010 error C3861: identifi

Visual Studio 2010 error C3861: identifier not found

So I’m a Java programmer that’s learning C++, and I decided to write a basic RPG-type game to teach myself about headers, pointers, libraries, etc. The methods below are meant to build an array of Equipment objects from all the files in the directory /data/equp. When I try to build the file, though, I get the error «Visual Studio 2010 error C3861: ‘readEquipment’ identifier not found» at line 23 below. I’m still a little fuzzy on when to use a pointer rather than an object, is that the problem?

Any bonus help regarding the actual process of reading the files in a directory is welcome as well. I have a feeling this will have any number of runtime or syntax errors after it finally compiles.

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
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>

#include "Windows.h"
#include "Character.h"
#include "Equipment.h"

using namespace std;

bool buildEquipment(Equipment* eqArr){
	WIN32_FIND_DATA findData;
	LPCSTR find = "./data/equp/*";
	HANDLE dir;
	int count = 0;

	dir = FindFirstFile(find, &findData);

	if (dir != INVALID_HANDLE_VALUE){
		do{
                        //ERROR LINE
			eqArr[count] = readEquipment(findData);
			count++;
		}while(FindNextFile(dir, &findData));
	}
	
	return true;
}

Equipment readEquipment(WIN32_FIND_DATA findData){
	ifstream myfile;
	myfile.open(findData.cFileName);
	string hold;
	Equipment eq;
		
	if(myfile.is_open()){
		//assign values from myFile to eq
	}
	myfile.close();
	return eq;
		
}

You need to prototype your method.

Add the following before any function definition:

 
Equipment readEquipment(WIN32_FIND_DATA findData);

Or you can put hte readEquipment() function before buildEquipment but eventually you may run into a circular dependency in which case only funciton prototyping can save you.

Thanks, that worked. I’ve been spoiled by Java classes always being aware of its fellow functions.

No problem. This is one of the annoying things of C/C++. Java got it done right!

C++ classes are also aware of their fellow functions. But you aren’t using classes….

EDIT: or maybe you meant to be but didn’t by mistake? Those functions you pasted are global .. not part of a class.

Last edited on

They were meant to be global, I’m again just used to putting everything in a class with Java, and haven’t shaken the habit of calling every source file a class.

Topic archived. No new replies allowed.

I’m getting two errors and can’t figure it out for the life of me…
I’ve researched it on google for the last few hours. I’m getting now where.
Here are the compile errors I’m getting.

    2   IntelliSense: identifier "RegisterShader" is undefined  c:usersadministratordocumentsvisual studio 2010projectstestdllmain.cpp   18  20  

Error   1   error C3861: 'RegisterShader': identifier not found c:usersadministratordocumentsvisual studio 2010projectstestdllmain.cpp   50  1   

// stdafx.h

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"

#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>

// TODO: reference additional headers your program requires here
#include <detours.h>
#include "typedefs.h"

// stdafx.cpp

// stdafx.cpp : source file that includes just the standard includes
// blopsII.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

// typedefs.h

#ifndef TYPEDEFS_H
#define TYPEDEFS_H

#define OFF_REGISTERSHADER 0x00715690

typedef float  vec_t;
typedef vec_t  vec2_t[2];
typedef vec_t  vec3_t[3];
typedef vec_t  vec4_t[4];
typedef int    qhandle_t;

typedef int ( * tRegisterShader )( char* szName, int unk );

#endif

// typedefs.cpp

#include "stdafx.h"

tRegisterShader RegisterShader = ( tRegisterShader )OFF_REGISTERSHADER;

// dllmain.cpp

// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

//#include "typedefs.h"

DWORD dwHook = 0x6ADC30;

void callback()
{

    qhandle_t white = RegisterShader("white", 3);
}


int __cdecl hkRender()
{
    _asm pushad;
    callback();
    _asm popad;
}


BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:



    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

Я только начал новый win32 консольное приложение в VS 2010 и установить Additional options собственность на precompiled headerв предстоящем мастере.

На основе один из моих предыдущих вопросов Я решил использовать следующий основной прототип:

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

Я также изменил Character Set свойство проекта к Use Multi-Byte Character Set,

Но следующий код:

system("pause");

Будет выдавать эти две ошибки:

error C3861: 'system': identifier not found
IntelliSense: identifier "system" is undefined

У меня был такой же опыт, и ошибок не было!
Кто-нибудь может подсказать мне, что не так?

2

Решение

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

В случае с system функция, это определено в stdlib.h заголовочный файл

Итак, в начало вашего файла кода (или в вашем предварительно скомпилированном заголовочном файле) добавьте строку

#include <stdlib.h>

(Вы используете угловые скобки вместо кавычек, потому что stdlib.h найден ли заголовок в том месте, о котором ранее сообщалось инструменту сборки; это включает в себя каталоги системных заголовков и другие каталоги, которые ваша конфигурация сборки специально требует.)

Помимо этого я сильно рекомендую против используя либо многобайтовый набор символов (все новые приложения Windows должны поддерживать Unicode), либо system функция, особенно system("pause"),

7

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

Для меня работало то, что #include "stdafx.h" был ПЕРВЫЙ ВКЛЮЧЕН в файл. Так #include <iostream> поэтому будет после этого.

Это решило проблему.

3

Понравилась статья? Поделить с друзьями:
  • Ошибка компилятора c3646
  • Ошибка компиляции для платы arduino uno как исправить
  • Ошибка компилятора c2995
  • Ошибка компиляции для платы arduino uno grbl
  • Ошибка компилятора c2784