Error lnk2001 неразрешенный внешний символ main

При попытке сборки программы появляется сообщение об ошибке одного из следующих видов: ссылка на неразрешенный внешний символ ... неопределённая ссылка на символ ... unresolved external symbol ...

Определение

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

К таким сущностям может относиться, например, функция или переменная.


Причины и решения

Возможных причин появления ошибки может быть несколько и это зависит от того, что представляет из себя собираемый проект. Всё множество ситуаций можно разбить на две большие группы:


Используются сторонние библиотеки

  • Не указана необходимая (статическая) библиотека для компоновщика.

    Например, к проекту подключен только *.h файл с объявлениями, но отсутствует код реализации, обычно это *.lib или *.a файлы (в зависимости от используемой системы).
    Требуется явно подключить библиотеку к проекту.

  • Для Visual C++ это можно сделать добавлением следующей строки прямо в код:

    #pragma comment(lib, "libname.lib")
    
  • Для gcc/clang требуется указать файл через ключ -l (эль)

  • Для Qt в .pro файле нужно использовать переменную LIBS:

    LIBS += -L[путь_к_библиотеке] -l[имя_библиотеки]
    
  • Для системы сборки cmake есть target_link_libraries.

  • Библиотека указана, но необходимая сущность, например, класс или функция фактически не экспортируется из библиотеки. Под Windows это может возникать из-за отсуствия __declspec(dllexport) перед сущностью. Обычно это решается макросами. Данная ситуация чаще всего характерна именно для библиотек, находящихся в процессе разработки, и доступных для модификации самому разработчику, нежели для каких-то стабильных версий действительно внешних для проекта библиотек. После разрешения экспортирования библиотеку, конечно же, нужно пересобрать перед непосредственным использованием проблемной сущности.

  • Библиотека указана, но не совпадает разрядность библиотеки и компилируемого кода.

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

  • Библиотека указана, но она собрана для другой (не совместимой) ОС.

    Например при сборке проекта в Windows осуществляется попытка использовать бинарный файл, собранный для Linux. В данном случае нужно использовать файлы, подходящие для вашей ОС.

  • Библиотека указана, но она собрана другим компилятором, не совместимым с используемым.

    Объектные файлы, полученные путем сборки C++ кода разными компиляторами для одной и той же ОС могут быть бинарно несовместимы друг с другом. Требуется использовать совместимые (скорее всего и вовсе одинаковые) компиляторы.

  • Библиотека указана, и собрана тем же компилятором, что и основной проект, но используются разные версии Run-Time библиотек.

    Например, для Visual C++ возможна ситуация, когда библиотека собрана с ключом /MDd, а основной проект с /MTd. Требуется задать ключи так, чтобы использовались одинаковые версии Run-Time библиотек.


Сторонние библиотеки не используются

  • Просто отсутствует определение функции.

    void f(int); // всего лишь объявление. Нет `тела` функции
    int main(){  
        f(42);   // undefined reference to `f(int)'
    }  
    

    Требуется добавить определение функции f:

    void f(int) {
        // тело функции
    }
    

    Может быть ещё частный случай с ошибкой вида:

    undefined reference to `vtable for <имя_класса>`
    

    Такая ошибка возникает, если объявленная виртуальная функция класса, не являющаяся чистой (=0), не содержит реализации.

    class C {
        virtual void f(int);
    };
    

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

    void C::f(int) { // виртуальная функция-член вне определения класса
        // тело функции  
    } 
    
    void f(int) { // свободная функция, не устраняющая проблему
        // тело функции 
    } 
    

    Аналогичная ситуация может возникать при использовании пространств имён, когда объявлении функции находится в пространстве имён:

    // В заголовочном файле
    namespace N {
        void f(int);
    };    
    

    а при реализации указать это пространство имён забыли:

    // В файле реализации
    void f(int) { // функция в глобальном пространстве имён, не устраняющая проблему
        // тело функции  
    }
    
    namespace N {
    void f(int) { // функция в нужном пространстве имён
        // тело функции  
    }
    } // конец пространства имён
    

    Стоит заметить, что C++ разрешает перегрузку функций (существование одноимённых функций, но с разным набором параметров), и в этом случае важно, чтобы сигнатуры функций при объявлении и определении совпадали. Например, вместо объявленной void f(int) была реализована другая:

    void f(const char*) { // const char* вместо int
        // тело функции     
    }
    

    При вызове f(42) будет ошибка:

    undefined reference to `f(int)'
    

    Наличие связки шаблонного класса и дружественной функции также может приводить к ошибке. Например:

    template <class T>
    struct C {
        friend void f(C<T>);   // объявляет *НЕ*шаблонную дружественную функцию
    };
    
    template <class T>         // определяет шаблонную функцию 
    void f(C<T>) { }
    
    int main() {
        C<int> c;
        f(c);                  // undefined reference to `f(C<int>)'
    }
    

    Чтобы объявить шаблонную дружественную функцию, требуется добавить указание шаблонности:

    template <class T>
    struct C {
        template <class V>     // добавили шаблонность для friend функции
        friend void f(C<T>);
    };
    

    Важно, что имя шаблонного параметра для дружественной функции должно отличаться от имени параметра шаблонного класса T, т.к. иначе будет ошибка о сокрытии имени. В частном случае имя класса можно вовсе не указывать, и оставить template <class>. Но это не всегда будет правильным решением, т.к. фактически могла потребоваться дружественная специализация шаблона функции, а не сама шаблонная функция. Подробнее об использовании дружественных функций в шаблонном классе можно ознакомиться здесь.

  • Отсутствует определение статической переменной класса.

    struct S {
        static int i;
    };
    
    int main() {
        S s;
        s.i = 42;  // undefined reference to `S::i'
    }
    

    Нужно добавить определение (выделить память) переменной:

    int S::i;
    
  • Неправильная реализация шаблонного кода.

    Например, реализация шаблонного кода помещена в *.cpp файл, хотя она должна находиться полностью в подключаемом *.h файле. Это требуется по той причине, что компилятор обрабатывает каждый модуль независимо, и в момент инстанцирования шаблона (подстановки конкретного типа) код его реализации должен быть виден. При этом если возможные типы шаблона известны заранее, можно произвести инстанцирование сразу рядом с телом шаблона и не предоставлять его наружу в исходном коде заголовочного файла. Пример:

    // unit.h
    #pragma once
    
    template <class T>
    T f(T);                    // объявление шаблона без реализации
    
    // unit.cpp
    #include "unit.h"
    
    template <class T>
    T f(T t) { return t + t; } // реализация шаблона
    
    template
    int f<int>(int);           // явное инстанцирование для int
    
    template
    double f<double>(double);  // явное инстанцирование для double
    
    // main.cpp
    #include "unit.h"
    
    int main() { 
        f(2);   // ok int
        f(1.5); // ok double
        f('a'); // undefined reference to `char f<char>(char)'
    }
    
  • Файл с кодом не был скомпилирован.

    Например, в случае использования make-файла не было прописано правило построения файла, а в случае использования IDE типа Visual Studio *.cpp файл не добавлен в список файлов проекта.

  • Виртуальная функция в базовом классе не объявлена как = 0 (pure-virtual).

    struct B {
        void virtual f();
    };
    
    struct D : B {
        void f() {}
    };
    
    int main() {
        D d;
    }
    

    При использовании иерархии классов функция в базовом классе, не имеющая реализации должна быть помечена как «чистая»:

    struct B {
        void virtual f() = 0;
    };
    
  • Имя не имеет внешнего связывания.

    Например, есть объявление функции f в модуле А и даже ее реализация в модуле B, но реализация помечена как static:

    // A.cpp
    void f();
    int main() {
        f();   // undefined reference to `f()'
    }
    
    // B.cpp
    static void f() {}
    

    Аналогичная ситуация может возникнуть при использовании безымянного пространства имен:

    // B.cpp
    namespace {
       void f() {}
    }
    

    Или даже при наличии inline у функции:

    // B.cpp
    inline void f() {}
    
description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Linker Tools Error LNK2001

Linker Tools Error LNK2001

10/22/2021

LNK2001

LNK2001

dc1cf267-c984-486c-abd2-fd07c799f7ef

unresolved external symbol «symbol«

The compiled code makes a reference or call to symbol. The symbol isn’t defined in any libraries or object files searched by the linker.

This error message is followed by fatal error LNK1120. To fix error LNK1120, first fix all LNK2001 and LNK2019 errors.

There are many ways to get LNK2001 errors. All of them involve a reference to a function or variable that the linker can’t resolve, or find a definition for. The compiler can identify when your code doesn’t declare a symbol, but not when it doesn’t define one. That’s because the definition may be in a different source file or library. If your code refers to a symbol, but it’s never defined, the linker generates an error.

What is an unresolved external symbol?

A symbol is the internal name for a function or global variable. It’s the form of the name used or defined in a compiled object file or library. A global variable is defined in the object file where storage is allocated for it. A function is defined in the object file where the compiled code for the function body is placed. An external symbol is one referenced in one object file, but defined in a different library or object file. An exported symbol is one that’s made publicly available by the object file or library that defines it.

To create an application or DLL, every symbol used must have a definition. The linker must resolve, or find the matching definition for, every external symbol referenced by each object file. The linker generates an error when it can’t resolve an external symbol. It means the linker couldn’t find a matching exported symbol definition in any of the linked files.

Compilation and link issues

This error can occur:

  • When the project is missing a reference to a library (.LIB) or object (.OBJ) file. To fix this issue, add a reference to the required library or object file to your project. For more information, see lib Files as linker input.

  • When the project has a reference to a library (.LIB) or object (.OBJ) file that in turn requires symbols from another library. It may happen even if you don’t call functions that cause the dependency. To fix this issue, add a reference to the other library to your project. For more information, see Understanding the classical model for linking: Taking symbols along for the ride.

  • If you use the /NODEFAULTLIB or /Zl options. When you specify these options, libraries that contain required code aren’t linked into the project unless you’ve explicitly included them. To fix this issue, explicitly include all the libraries you use on the link command line. If you see many missing CRT or Standard Library function names when you use these options, explicitly include the CRT and Standard Library DLLs or library files in the link.

  • If you compile using the /clr option. There may be a missing reference to .cctor. For more information on how to fix this issue, see Initialization of mixed assemblies.

  • If you link to the release mode libraries when building a debug version of an application. Similarly, if you use options /MTd or /MDd or define _DEBUG and then link to the release libraries, you should expect many potential unresolved externals, among other problems. Linking a release mode build with the debug libraries also causes similar problems. To fix this issue, make sure you use the debug libraries in your debug builds, and retail libraries in your retail builds.

  • If your code refers to a symbol from one library version, but you link a different version of the library. Generally, you can’t mix object files or libraries that are built for different versions of the compiler. The libraries that ship in one version may contain symbols that can’t be found in the libraries included with other versions. To fix this issue, build all the object files and libraries with the same version of the compiler before linking them together. For more information, see C++ binary compatibility between Visual Studio versions.

  • If library paths are out of date. The Tools > Options > Projects > VC++ Directories dialog, under the Library files selection, allows you to change the library search order. The Linker folder in the project’s Property Pages dialog box may also contain paths that could be out of date.

  • When a new Windows SDK is installed (perhaps to a different location). The library search order must be updated to point to the new location. Normally, you should put the path to new SDK include and lib directories in front of the default Visual C++ location. Also, a project containing embedded paths may still point to old paths that are valid, but out of date. Update the paths for new functionality added by the new version that’s installed to a different location.

  • If you build at the command line, and have created your own environment variables. Verify that the paths to tools, libraries, and header files go to a consistent version. For more information, see Use the MSVC toolset from the command line.

Coding issues

This error can be caused by:

  • Mismatched case in your source code or module-definition (.def) file. For example, if you name a variable var1 in one C++ source file and try to access it as VAR1 in another, this error is generated. To fix this issue, use consistently spelled and cased names.

  • A project that uses function inlining. It can occur when you define the functions as inline in a source file, rather than in a header file. Inlined functions can’t be seen outside the source file that defines them. To fix this issue, define the inlined functions in the headers where they’re declared.

  • Calling a C function from a C++ program without using an extern "C" declaration for the C function. The compiler uses different internal symbol naming conventions for C and C++ code. The internal symbol name is what the linker looks for when resolving symbols. To fix this issue, use an extern "C" wrapper around all declarations of C functions used in your C++ code, which causes the compiler to use the C internal naming convention for those symbols. Compiler options /Tp and /Tc cause the compiler to compile files as C++ or C, respectively, no matter what the filename extension is. These options can cause internal function names different from what you expect.

  • An attempt to reference functions or data that don’t have external linkage. In C++, inline functions and const data have internal linkage unless explicitly specified as extern. To fix this issue, use explicit extern declarations on symbols referred to outside the defining source file.

  • A missing function body or variable definition. This error is common when you declare, but don’t define, variables, functions, or classes in your code. The compiler only needs a function prototype or extern variable declaration to generate an object file without error, but the linker can’t resolve a call to the function or a reference to the variable because there’s no function code or variable space reserved. To fix this issue, make sure to define every referenced function and variable in a source file or library you link.

  • A function call that uses return and parameter types or calling conventions that don’t match the ones in the function definition. In C++ object files, Name decoration encodes the calling convention, class or namespace scope, and return and parameter types of a function. The encoded string becomes part of the final decorated function name. This name is used by the linker to resolve, or match, calls to the function from other object files. To fix this issue, make sure the function declaration, definition, and calls all use the same scopes, types, and calling conventions.

  • C++ code you call, when you include a function prototype in a class definition, but don’t include the implementation of the function. To fix this issue, be sure to provide a definition for all class members you call.

  • An attempt to call a pure virtual function from an abstract base class. A pure virtual function has no base class implementation. To fix this issue, make sure all called virtual functions are implemented.

  • Trying to use a variable declared within a function (a local variable) outside the scope of that function. To fix this issue, remove the reference to the variable that isn’t in scope, or move the variable to a higher scope.

  • When you build a Release version of an ATL project, producing a message that CRT startup code is required. To fix this issue, do one of the following,

    • Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. For more information, see General property page (Project).

    • If possible, remove calls to CRT functions that require CRT startup code. Instead, use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code are some of the string and floating point functions.

Consistency issues

There’s currently no standard for C++ name decoration between compiler vendors, or even between different versions of the same compiler. Object files compiled with different compilers may not use the same naming scheme. Linking them can cause error LNK2001.

Mixing inline and non-inline compile options on different modules can cause LNK2001. If a C++ library is created with function inlining turned on (/Ob1 or /Ob2) but the corresponding header file describing the functions has inlining turned off (no inline keyword), this error occurs. To fix this issue, define the functions inline in the header file you include in other source files.

If you use the #pragma inline_depth compiler directive, make sure you’ve set a value of 2 or greater, and make sure you also use the /Ob1 or /Ob2 compiler option.

This error can occur if you omit the LINK option /NOENTRY when you create a resource-only DLL. To fix this issue, add the /NOENTRY option to the link command.

This error can occur if you use incorrect /SUBSYSTEM or /ENTRY settings in your project. For example, if you write a console application and specify /SUBSYSTEM:WINDOWS, an unresolved external error is generated for WinMain. To fix this issue, make sure you match the options to the project type. For more information on these options and entry points, see the /SUBSYSTEM and /ENTRY linker options.

Exported .def file symbol issues

This error occurs when an export listed in a .def file isn’t found. It could be because the export doesn’t exist, is spelled incorrectly, or uses C++ decorated names. A .def file doesn’t take decorated names. To fix this issue, remove unneeded exports, and use extern "C" declarations for exported symbols.

Use the decorated name to find the error

The C++ compiler and linker use Name Decoration, also known as name-mangling. Name decoration encodes extra information about the type of a variable in its symbol name. The symbol name for a function encodes its return type, parameter types, scope, and calling convention. This decorated name is the symbol name the linker searches for to resolve external symbols.

A link error can result if the declaration of a function or variable doesn’t exactly match the definition of the function or variable. That’s because any difference becomes part of the symbol name to match. The error can happen even if the same header file is used in both the calling code and the defining code. One way it may occur is if you compile the source files by using different compiler flags. For example, if your code is compiled to use the __vectorcall calling convention, but you link to a library that expects clients to call it using the default __cdecl or __fastcall calling convention. In this case, the symbols don’t match because the calling conventions are different.

To help you find the cause, the error message shows you two versions of the name. It displays both the «friendly name,» the name used in source code, and the decorated name (in parentheses). You don’t need to know how to interpret the decorated name. You can still search for and compare it with other decorated names. Command-line tools can help to find and compare the expected symbol name and the actual symbol name:

  • The /EXPORTS and /SYMBOLS options of the DUMPBIN command-line tool are useful here. They can help you discover which symbols are defined in your .dll and object or library files. You can use the symbols list to verify that the exported decorated names match the decorated names the linker searches for.

  • In some cases, the linker can only report the decorated name for a symbol. You can use the UNDNAME command-line tool to get the undecorated form of a decorated name.

Additional resources

For more information, see the Stack Overflow question «What is an undefined reference/unresolved external symbol error and how do I fix it?».

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Linker Tools Error LNK2001

Linker Tools Error LNK2001

10/22/2021

LNK2001

LNK2001

dc1cf267-c984-486c-abd2-fd07c799f7ef

unresolved external symbol «symbol«

The compiled code makes a reference or call to symbol. The symbol isn’t defined in any libraries or object files searched by the linker.

This error message is followed by fatal error LNK1120. To fix error LNK1120, first fix all LNK2001 and LNK2019 errors.

There are many ways to get LNK2001 errors. All of them involve a reference to a function or variable that the linker can’t resolve, or find a definition for. The compiler can identify when your code doesn’t declare a symbol, but not when it doesn’t define one. That’s because the definition may be in a different source file or library. If your code refers to a symbol, but it’s never defined, the linker generates an error.

What is an unresolved external symbol?

A symbol is the internal name for a function or global variable. It’s the form of the name used or defined in a compiled object file or library. A global variable is defined in the object file where storage is allocated for it. A function is defined in the object file where the compiled code for the function body is placed. An external symbol is one referenced in one object file, but defined in a different library or object file. An exported symbol is one that’s made publicly available by the object file or library that defines it.

To create an application or DLL, every symbol used must have a definition. The linker must resolve, or find the matching definition for, every external symbol referenced by each object file. The linker generates an error when it can’t resolve an external symbol. It means the linker couldn’t find a matching exported symbol definition in any of the linked files.

Compilation and link issues

This error can occur:

  • When the project is missing a reference to a library (.LIB) or object (.OBJ) file. To fix this issue, add a reference to the required library or object file to your project. For more information, see lib Files as linker input.

  • When the project has a reference to a library (.LIB) or object (.OBJ) file that in turn requires symbols from another library. It may happen even if you don’t call functions that cause the dependency. To fix this issue, add a reference to the other library to your project. For more information, see Understanding the classical model for linking: Taking symbols along for the ride.

  • If you use the /NODEFAULTLIB or /Zl options. When you specify these options, libraries that contain required code aren’t linked into the project unless you’ve explicitly included them. To fix this issue, explicitly include all the libraries you use on the link command line. If you see many missing CRT or Standard Library function names when you use these options, explicitly include the CRT and Standard Library DLLs or library files in the link.

  • If you compile using the /clr option. There may be a missing reference to .cctor. For more information on how to fix this issue, see Initialization of mixed assemblies.

  • If you link to the release mode libraries when building a debug version of an application. Similarly, if you use options /MTd or /MDd or define _DEBUG and then link to the release libraries, you should expect many potential unresolved externals, among other problems. Linking a release mode build with the debug libraries also causes similar problems. To fix this issue, make sure you use the debug libraries in your debug builds, and retail libraries in your retail builds.

  • If your code refers to a symbol from one library version, but you link a different version of the library. Generally, you can’t mix object files or libraries that are built for different versions of the compiler. The libraries that ship in one version may contain symbols that can’t be found in the libraries included with other versions. To fix this issue, build all the object files and libraries with the same version of the compiler before linking them together. For more information, see C++ binary compatibility between Visual Studio versions.

  • If library paths are out of date. The Tools > Options > Projects > VC++ Directories dialog, under the Library files selection, allows you to change the library search order. The Linker folder in the project’s Property Pages dialog box may also contain paths that could be out of date.

  • When a new Windows SDK is installed (perhaps to a different location). The library search order must be updated to point to the new location. Normally, you should put the path to new SDK include and lib directories in front of the default Visual C++ location. Also, a project containing embedded paths may still point to old paths that are valid, but out of date. Update the paths for new functionality added by the new version that’s installed to a different location.

  • If you build at the command line, and have created your own environment variables. Verify that the paths to tools, libraries, and header files go to a consistent version. For more information, see Use the MSVC toolset from the command line.

Coding issues

This error can be caused by:

  • Mismatched case in your source code or module-definition (.def) file. For example, if you name a variable var1 in one C++ source file and try to access it as VAR1 in another, this error is generated. To fix this issue, use consistently spelled and cased names.

  • A project that uses function inlining. It can occur when you define the functions as inline in a source file, rather than in a header file. Inlined functions can’t be seen outside the source file that defines them. To fix this issue, define the inlined functions in the headers where they’re declared.

  • Calling a C function from a C++ program without using an extern "C" declaration for the C function. The compiler uses different internal symbol naming conventions for C and C++ code. The internal symbol name is what the linker looks for when resolving symbols. To fix this issue, use an extern "C" wrapper around all declarations of C functions used in your C++ code, which causes the compiler to use the C internal naming convention for those symbols. Compiler options /Tp and /Tc cause the compiler to compile files as C++ or C, respectively, no matter what the filename extension is. These options can cause internal function names different from what you expect.

  • An attempt to reference functions or data that don’t have external linkage. In C++, inline functions and const data have internal linkage unless explicitly specified as extern. To fix this issue, use explicit extern declarations on symbols referred to outside the defining source file.

  • A missing function body or variable definition. This error is common when you declare, but don’t define, variables, functions, or classes in your code. The compiler only needs a function prototype or extern variable declaration to generate an object file without error, but the linker can’t resolve a call to the function or a reference to the variable because there’s no function code or variable space reserved. To fix this issue, make sure to define every referenced function and variable in a source file or library you link.

  • A function call that uses return and parameter types or calling conventions that don’t match the ones in the function definition. In C++ object files, Name decoration encodes the calling convention, class or namespace scope, and return and parameter types of a function. The encoded string becomes part of the final decorated function name. This name is used by the linker to resolve, or match, calls to the function from other object files. To fix this issue, make sure the function declaration, definition, and calls all use the same scopes, types, and calling conventions.

  • C++ code you call, when you include a function prototype in a class definition, but don’t include the implementation of the function. To fix this issue, be sure to provide a definition for all class members you call.

  • An attempt to call a pure virtual function from an abstract base class. A pure virtual function has no base class implementation. To fix this issue, make sure all called virtual functions are implemented.

  • Trying to use a variable declared within a function (a local variable) outside the scope of that function. To fix this issue, remove the reference to the variable that isn’t in scope, or move the variable to a higher scope.

  • When you build a Release version of an ATL project, producing a message that CRT startup code is required. To fix this issue, do one of the following,

    • Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. For more information, see General property page (Project).

    • If possible, remove calls to CRT functions that require CRT startup code. Instead, use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code are some of the string and floating point functions.

Consistency issues

There’s currently no standard for C++ name decoration between compiler vendors, or even between different versions of the same compiler. Object files compiled with different compilers may not use the same naming scheme. Linking them can cause error LNK2001.

Mixing inline and non-inline compile options on different modules can cause LNK2001. If a C++ library is created with function inlining turned on (/Ob1 or /Ob2) but the corresponding header file describing the functions has inlining turned off (no inline keyword), this error occurs. To fix this issue, define the functions inline in the header file you include in other source files.

If you use the #pragma inline_depth compiler directive, make sure you’ve set a value of 2 or greater, and make sure you also use the /Ob1 or /Ob2 compiler option.

This error can occur if you omit the LINK option /NOENTRY when you create a resource-only DLL. To fix this issue, add the /NOENTRY option to the link command.

This error can occur if you use incorrect /SUBSYSTEM or /ENTRY settings in your project. For example, if you write a console application and specify /SUBSYSTEM:WINDOWS, an unresolved external error is generated for WinMain. To fix this issue, make sure you match the options to the project type. For more information on these options and entry points, see the /SUBSYSTEM and /ENTRY linker options.

Exported .def file symbol issues

This error occurs when an export listed in a .def file isn’t found. It could be because the export doesn’t exist, is spelled incorrectly, or uses C++ decorated names. A .def file doesn’t take decorated names. To fix this issue, remove unneeded exports, and use extern "C" declarations for exported symbols.

Use the decorated name to find the error

The C++ compiler and linker use Name Decoration, also known as name-mangling. Name decoration encodes extra information about the type of a variable in its symbol name. The symbol name for a function encodes its return type, parameter types, scope, and calling convention. This decorated name is the symbol name the linker searches for to resolve external symbols.

A link error can result if the declaration of a function or variable doesn’t exactly match the definition of the function or variable. That’s because any difference becomes part of the symbol name to match. The error can happen even if the same header file is used in both the calling code and the defining code. One way it may occur is if you compile the source files by using different compiler flags. For example, if your code is compiled to use the __vectorcall calling convention, but you link to a library that expects clients to call it using the default __cdecl or __fastcall calling convention. In this case, the symbols don’t match because the calling conventions are different.

To help you find the cause, the error message shows you two versions of the name. It displays both the «friendly name,» the name used in source code, and the decorated name (in parentheses). You don’t need to know how to interpret the decorated name. You can still search for and compare it with other decorated names. Command-line tools can help to find and compare the expected symbol name and the actual symbol name:

  • The /EXPORTS and /SYMBOLS options of the DUMPBIN command-line tool are useful here. They can help you discover which symbols are defined in your .dll and object or library files. You can use the symbols list to verify that the exported decorated names match the decorated names the linker searches for.

  • In some cases, the linker can only report the decorated name for a symbol. You can use the UNDNAME command-line tool to get the undecorated form of a decorated name.

Additional resources

For more information, see the Stack Overflow question «What is an undefined reference/unresolved external symbol error and how do I fix it?».

0 / 0 / 0

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

Сообщений: 39

1

12.11.2016, 16:45. Показов 3088. Ответов 3


1>MSVCRT.lib(crtexe.obj) : error LNK2001: неразрешенный внешний символ «_main»
Что это такое и как его убрать?

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



0



Вездепух

Эксперт CЭксперт С++

10435 / 5704 / 1553

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

Сообщений: 14,100

12.11.2016, 20:39

2

Не забывать, что всякая программа на языке С++ должна содержать главную функцию — main. Куда девался ваш main?



0



0 / 0 / 0

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

Сообщений: 39

12.11.2016, 21:33

 [ТС]

3

Дело в том, что мейн есть



0



Вездепух

Эксперт CЭксперт С++

10435 / 5704 / 1553

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

Сообщений: 14,100

13.11.2016, 10:43

4

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

Дело в том, что мейн есть

Где он есть? Мало того, что «мейн есть». Надо еще, чтобы компилятор его видел. У вас — не видит.



0



IT_Exp

Эксперт

87844 / 49110 / 22898

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

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

13.11.2016, 10:43

4

  • Remove From My Forums
  • Question

  • Hello everybody,

    I’m experiencing linkage issues while trying to compile a program.

    Anyone out there wanna try to help me?

    Linking...
    CreatureSpriteTable.obj : error LNK2001: unresolved external symbol "class EditString * pdlgEditString" (?pdlgEditString@@3PAVEditString@@A)
    CreatureSpriteTable.obj : error LNK2001: unresolved external symbol "public: void __thiscall CNewEdit::AddString(char const *)" (?AddString@CNewEdit@@QAEXPBD@Z)
    InitCreatureTable.obj : error LNK2001: unresolved external symbol "public: void __thiscall CNewEdit::AddString(char const *)" (?AddString@CNewEdit@@QAEXPBD@Z)
    InitInfo.obj : error LNK2001: unresolved external symbol "public: void __thiscall CNewEdit::AddString(char const *)" (?AddString@CNewEdit@@QAEXPBD@Z)
    
    InitCreatureTable.obj : error LNK2001: unresolved external symbol "class CNewEdit * pedit" (?pedit@@3PAVCNewEdit@@A)
    InitInfo.obj : error LNK2001: unresolved external symbol "class CNewEdit * pedit" (?pedit@@3PAVCNewEdit@@A)
    Debug/ClientInfo.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.
    
    ClientInfo.exe - 8 error(s), 0 warning(s)

    I’m using Visual C++

Answers

  • If you get  unresolved external symbol means, you have used the class/function in your program. But, the linker is not able to find the definition. 

    If the EditString/CNewEdit::AddString used in executable, you should define in your application.

    If you are tying to use 3rd party application
    DLL, you should link with the Libarry (*.lib) file. you can also use run time linking using

    LoadLibrary/GetProcAddress family function.

    If you want more information about Link 2001, you can check the following msdn link

    http://msdn.microsoft.com/en-us/library/f6xx1b1z(VS.80).aspx


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/

    • Marked as answer by

      Friday, November 25, 2011 9:30 AM

  • Hi,

    As 
    Selvam’s suggestion, LNK2001 means that the Visual Studio or Visual C+ cannot find the definition of the function or class. That mean
     you need to add the LIB or DLL to your project.

    According to your description, I suggest you can ask your friend and find out whether or not there is any other LIB or DLL. Then you can add these libraries to the
    Visual C++ by these step:

    1. 
    Select Tools menu and click option.

    2. Click Directories tab and choose the “Library Files” in Show directories for option.

    3. Double click the blank in the Directories option and add the path of the LIBs or DLLs

    4. Repeat these steps to add the Include files or other option.

    5. Select Ok to finish.

    In addition, you can also load the libraries dynamically. Please check these reference:

    1.
    http://msdn.microsoft.com/en-us/library/ms686923(v=VS.85).aspx

    2.
    http://msdn.microsoft.com/en-us/library/ms686944(v=VS.85).aspx

    Best Regards,

    Rob


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by
      Rob Pan
      Friday, November 25, 2011 9:30 AM

#pragma once
#include «filt1.h»
//#include «filt_gen.h»

//extern void cf(double *h,int hsize,double fs, double f0, double sf, double ef, double *rcf, double *icf);
//extern int filt_gen(double lf,double hf,double* resp);
//extern int differ_gen(double lf,double* resp);

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace ZedGraph;
//static int click;
//static double coordY[4][64], coordX[4][64];

extern double coordY[4][64], coordX[4][64];
extern bool canalOpen[5];
static double l1,l2[5],l3,t;
static short * pbf;
static int per, Canal;
extern int set_generator(int phase,int amplityde, int canal);
extern int set_amp(int att, int gain, int canal);
extern int set_frequency(double frequency, int freq_unit, int canal);
extern int set_compensator(int phase,int amplityde, int canal);
extern int get_amp1();
extern int balance(int canal);

namespace vihretok {
    /// <summary>
    /// Сводка для Def
    ///
    /// Внимание! При изменении имени этого класса необходимо также изменить
    ///          свойство имени файла ресурсов («Resource File Name») для средства компиляции управляемого ресурса,
    ///          связанного со всеми файлами с расширением .resx, от которых зависит данный класс. В противном случае,
    ///          конструкторы не смогут правильно работать с локализованными
    ///          ресурсами, сопоставленными данной форме.
    /// </summary>
    public ref class Def : public System::Windows::Forms::Form
    {
                public: void Load_Graw (void)
                        {
                                // Получим панель для рисования
                                ZedGraph::GraphPane ^myPane1 = zedGraphControl1>GraphPane;
                                // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
                                //myPane1->CurveList->Clear();
                                //myPane1->GraphObjList->Clear();
                                //Запрет на самосогласования и выход за установленные границы
                                myPane1>XAxis>Scale>MaxGrace=0;
                                myPane1>XAxis>Scale>MinGrace=0;
                                myPane1>YAxis>Scale>MaxGrace=0;
                                myPane1>YAxis>Scale>MinGrace=0;
                                // Подписи к графику и к осям
                                // Установим размеры шрифтов для подписей по осям
                                myPane1>XAxis>Title>FontSpec>Size = 16;
                                myPane1>YAxis>Title>FontSpec>Size = 16;
                                // Установим размеры шрифта для легенды
                                myPane1>Legend>FontSpec>Size = 12;
                                // Установим размеры шрифта для общего заголовка
                                myPane1>Title>FontSpec>Size = 17;
                                myPane1>Title>FontSpec>FontColor=System::Drawing::Color::Brown;
                                myPane1>Title>Text = «Отклонение по X»;
                                myPane1>XAxis>Title>Text = «Измерение»;
                                myPane1>YAxis>Title>Text = «Отклонение»;
                                //Установка фона панели графиков (не рабочая часть)
                                myPane1>Fill>Color=System::Drawing::Color::LightBlue;
                                //Установка фона панели отображения графиков
                                myPane1>Chart>Fill = gcnew Fill( Color::White, Color::Aqua, 90 );
                                //Установка границы вывода графиков
                                myPane1>Chart>Border>Color=System::Drawing::Color::Black;
                                // Устанавливаем интересующий нас интервал по оси X
                                myPane1>XAxis>Scale>Min = l2[Convert::ToInt32(lCanal>Text)]2*t;
                                myPane1>XAxis>Scale>Max = l2[Convert::ToInt32(lCanal>Text)]+2*t;
                                //Ручная установка шага оси Х —  1 В
                                //myPane1->XAxis->Scale->MinorStep = 0.1;
                                myPane1>XAxis>Scale>MajorStep = 25;
                                // Устанавливаем интересующий нас интервал по оси Y — значения в мА от -10 до 100 мА
                                myPane1>YAxis>Scale>Min = t;
                                myPane1>YAxis>Scale>Max = t;
                                //myPane1->YAxis->Scale->MinorStep = 0.1;
                                myPane1>YAxis>Scale>MajorStep = 25;
                                //Установка оси «Y» ровно по оси «Х» 0.0
                                myPane1>XAxis>Cross = 0.0;
                                //Устанавливаем метки только возле осей!
                                myPane1>XAxis>MajorTic>IsOpposite = false;
                                myPane1>XAxis>MinorTic>IsOpposite = false;
                                myPane1>YAxis>MajorTic>IsOpposite = false;
                                myPane1>YAxis>MinorTic>IsOpposite = false;
                                //Рисуем сетку по X
                                myPane1>XAxis>MajorGrid>IsVisible=true;
                                myPane1>XAxis>MajorGrid>DashOn=20;
                                myPane1>XAxis>MajorGrid>DashOff=20;
                                myPane1>XAxis>MajorGrid>Color=System::Drawing::Color::Gray;
                                myPane1>XAxis>Color=System::Drawing::Color::Gray;
                                //Рисуем сетку по Y
                                myPane1>YAxis>MajorGrid>IsVisible=true;
                                myPane1>YAxis>MajorGrid>DashOn=20;
                                myPane1>YAxis>MajorGrid>DashOff=20;
                                myPane1>YAxis>MajorGrid>Color=System::Drawing::Color::Gray;
                                myPane1>YAxis>Color=System::Drawing::Color::Gray;

                                // Получим панель для рисования
                                ZedGraph::GraphPane ^myPane3 = zedGraphControl3>GraphPane;
                                // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
                                //myPane2->CurveList->Clear();
                                //myPane2->GraphObjList->Clear();
                                //Запрет на самосогласования и выход за установленные границы
                                myPane3>XAxis>Scale>MaxGrace=0;
                                myPane3>XAxis>Scale>MinGrace=0;
                                myPane3>YAxis>Scale>MaxGrace=0;
                                myPane3>YAxis>Scale>MinGrace=0;
                                // Подписи к графику и к осям
                                // Установим размеры шрифтов для подписей по осям
                                myPane3>XAxis>Title>FontSpec>Size = 16;
                                myPane3>YAxis>Title>FontSpec>Size = 16;
                                // Установим размеры шрифта для легенды
                                myPane3>Legend>FontSpec>Size = 12;
                                // Установим размеры шрифта для общего заголовка
                                myPane3>Title>FontSpec>Size = 17;
                                myPane3>Title>FontSpec>FontColor=System::Drawing::Color::Brown;
                                myPane3>Title>Text = «Отклонение по Z»;
                                myPane3>XAxis>Title>Text = «Отклонение по Х»;
                                myPane3>YAxis>Title>Text = «Отклонение по Y»;
                                //Установка фона панели графиков (не рабочая часть)
                                myPane3>Fill>Color=System::Drawing::Color::LightBlue;
                                //Установка фона панели отображения графиков
                                myPane3>Chart>Fill = gcnew Fill( Color::White, Color::Aqua, 90 );
                                //Установка границы вывода графиков
                                myPane3>Chart>Border>Color=System::Drawing::Color::Black;
                                // Устанавливаем интересующий нас интервал по оси X
                                myPane3>XAxis>Scale>Min = t;
                                myPane3>XAxis>Scale>Max = t;
                                //Ручная установка шага оси Х —  1 В
                                //myPane1->XAxis->Scale->MinorStep = 0.1;
                                myPane3>XAxis>Scale>MajorStep = 25;
                                // Устанавливаем интересующий нас интервал по оси Y — значения в мА от -10 до 100 мА
                                myPane3>YAxis>Scale>Min = t;
                                myPane3>YAxis>Scale>Max = t;
                                //myPane1->YAxis->Scale->MinorStep = 0.1;
                                myPane3>YAxis>Scale>MajorStep = 25;
                                //Установка оси «Y» ровно по оси «Х» 0.0
                                myPane3>XAxis>Cross = 0.0;
                                //Устанавливаем метки только возле осей!
                                myPane3>XAxis>MajorTic>IsOpposite = false;
                                myPane3>XAxis>MinorTic>IsOpposite = false;
                                myPane3>YAxis>MajorTic>IsOpposite = false;
                                myPane3>YAxis>MinorTic>IsOpposite = false;
                                //Рисуем сетку по X
                                myPane3>XAxis>MajorGrid>IsVisible=true;
                                myPane3>XAxis>MajorGrid>DashOn=20;
                                myPane3>XAxis>MajorGrid>DashOff=20;
                                myPane3>XAxis>MajorGrid>Color=System::Drawing::Color::Gray;
                                myPane3>XAxis>Color=System::Drawing::Color::Gray;
                                //Рисуем сетку по Y
                                myPane3>YAxis>MajorGrid>IsVisible=true;
                                myPane3>YAxis>MajorGrid>DashOn=20;
                                myPane3>YAxis>MajorGrid>DashOff=20;
                                myPane3>YAxis>MajorGrid>Color=System::Drawing::Color::Gray;
                                myPane3>YAxis>Color=System::Drawing::Color::Gray;

                                // Получим панель для рисования
                                ZedGraph::GraphPane ^myPane2 = zedGraphControl2>GraphPane;
                                // Очистим список кривых на тот случай, если до этого сигналы уже были нарисованы
                                //myPane2->CurveList->Clear();
                                //myPane2->GraphObjList->Clear();
                                //Запрет на самосогласования и выход за установленные границы
                                myPane2>XAxis>Scale>MaxGrace=0;
                                myPane2>XAxis>Scale>MinGrace=0;
                                myPane2>YAxis>Scale>MaxGrace=0;
                                myPane2>YAxis>Scale>MinGrace=0;
                                // Подписи к графику и к осям
                                // Установим размеры шрифтов для подписей по осям
                                myPane2>XAxis>Title>FontSpec>Size = 16;
                                myPane2>YAxis>Title>FontSpec>Size = 16;
                                // Установим размеры шрифта для легенды
                                myPane2>Legend>FontSpec>Size = 12;
                                // Установим размеры шрифта для общего заголовка
                                myPane2>Title>FontSpec>Size = 17;
                                myPane2>Title>FontSpec>FontColor=System::Drawing::Color::Brown;
                                myPane2>Title>Text = «Отклонение по Y»;
                                myPane2>XAxis>Title>Text = «Измерение»;
                                myPane2>YAxis>Title>Text = «Отклонение»;
                                //Установка фона панели графиков (не рабочая часть)
                                myPane2>Fill>Color=System::Drawing::Color::LightBlue;
                                //Установка фона панели отображения графиков
                                myPane2>Chart>Fill = gcnew Fill( Color::White, Color::Aqua, 90 );
                                //Установка границы вывода графиков
                                myPane2>Chart>Border>Color=System::Drawing::Color::Black;
                                // Устанавливаем интересующий нас интервал по оси X
                                myPane2>XAxis>Scale>Min = l2[Convert::ToInt32(lCanal>Text)]t*2;
                                myPane2>XAxis>Scale>Max = l2[Convert::ToInt32(lCanal>Text)]+t*2;
                                //Ручная установка шага оси Х —  1 В
                                //myPane1->XAxis->Scale->MinorStep = 0.1;
                                myPane2>XAxis>Scale>MajorStep = 25;
                                // Устанавливаем интересующий нас интервал по оси Y — значения в мА от -10 до 100 мА
                                myPane2>YAxis>Scale>Min = t;
                                myPane2>YAxis>Scale>Max = t;
                                //myPane1->YAxis->Scale->MinorStep = 0.1;
                                myPane2>YAxis>Scale>MajorStep = 25;
                                //Установка оси «Y» ровно по оси «Х» 0.0
                                myPane2>XAxis>Cross = 0.0;
                                //Устанавливаем метки только возле осей!
                                myPane2>XAxis>MajorTic>IsOpposite = false;
                                myPane2>XAxis>MinorTic>IsOpposite = false;
                                myPane2>YAxis>MajorTic>IsOpposite = false;
                                myPane2>YAxis>MinorTic>IsOpposite = false;
                                //Рисуем сетку по X
                                myPane2>XAxis>MajorGrid>IsVisible=true;
                                myPane2>XAxis>MajorGrid>DashOn=20;
                                myPane2>XAxis>MajorGrid>DashOff=20;
                                myPane2>XAxis>MajorGrid>Color=System::Drawing::Color::Gray;
                                myPane2>XAxis>Color=System::Drawing::Color::Gray;
                                //Рисуем сетку по Y
                                myPane2>YAxis>MajorGrid>IsVisible=true;
                                myPane2>YAxis>MajorGrid>DashOn=20;
                                myPane2>YAxis>MajorGrid>DashOff=20;
                                myPane2>YAxis>MajorGrid>Color=System::Drawing::Color::Gray;
                                myPane2>YAxis>Color=System::Drawing::Color::Gray;

                                //******************************************************************************
                                // Добавляем информацию по регистрам вывода точек
                                //******************************************************************************
                                RollingPointPairList ^list1 = gcnew RollingPointPairList (64);
                                RollingPointPairList ^list2 = gcnew RollingPointPairList (64);
                                RollingPointPairList ^list3 = gcnew RollingPointPairList (64);
                                // Выводим пустые линии графиков на экран
                                LineItem ^F1Curve = myPane1>AddCurve( «», list1, Color::Indigo, SymbolType::None);
                                LineItem ^F2Curve = myPane2>AddCurve( «», list2, Color::Blue, SymbolType::None);
                                LineItem ^F3Curve = myPane3>AddCurve( «», list3, Color::BlueViolet, SymbolType::None);
                                //Ширина линии в 1/72 дюйма!!!!!!!!!! Хорошо получается при 2!!!!!!!!!
                                F1Curve>Line>Width=2;
                                F2Curve>Line>Width=2;
                                F3Curve>Line>Width=1;
                                //Задаем что линии гладкии!!!!!!!
                                F1Curve>Line>IsSmooth=true;
                                F2Curve>Line>IsSmooth=true;
                                F3Curve>Line>IsSmooth=true;
                                // Вызываем метод AxisChange (), чтобы обновить данные об осях.
                                // В противном случае на рисунке будет показана только часть графика,
                                // которая умещается в интервалы по осям, установленные по умолчанию
                                zedGraphControl1>AxisChange ();
                                zedGraphControl2>AxisChange ();
                                zedGraphControl3>AxisChange ();
                                // Обновляем график
                                zedGraphControl1>Invalidate();
                                zedGraphControl2>Invalidate();
                                zedGraphControl3>Invalidate();

                        }
        //График для функций
        public: void Graw_Draw (void)
                        {
                                //Получаем линии от графиков
                                LineItem ^F1Curve=(LineItem ^)zedGraphControl1>GraphPane>CurveList[0];
                                LineItem ^F2Curve=(LineItem ^)zedGraphControl2>GraphPane>CurveList[0];
                                LineItem ^F3Curve=(LineItem ^)zedGraphControl3>GraphPane>CurveList[0];
                                IPointListEdit ^list1= (IPointListEdit ^) F1Curve>Points;
                                IPointListEdit ^list2= (IPointListEdit ^) F2Curve>Points;
                                IPointListEdit ^list3= (IPointListEdit ^) F3Curve>Points;
                                //for (unsigned int i=0; i<200; i++)
                                //{
                                //  int x;
                                //  x=(i-10)*(i-10);
                                        list1>Add(l2[Convert::ToInt32(lCanal>Text)], l1);
                                        list2>Add(l2[Convert::ToInt32(lCanal>Text)], l3);
                                        list3>Add(l1, l3);
                                //}
                                // Вызываем метод AxisChange (), чтобы обновить данные об осях.
                                // В противном случае на рисунке будет показана только часть графика,
                                // которая умещается в интервалы по осям, установленные по умолчанию
                                zedGraphControl1>AxisChange ();
                                zedGraphControl2>AxisChange ();
                                zedGraphControl3>AxisChange();

                               
                               
                                // Обновляем график
                                zedGraphControl1>Invalidate();
                                zedGraphControl2>Invalidate();
                                //************************
                }
    public:
        Def(void)
        {
                    l1=0;
                    //l2[Canal]=0;
                    l3=0;
                    t=5;

            InitializeComponent();
            //
            //TODO: добавьте код конструктора
            //
        }

    protected:
        /// <summary>
        /// Освободить все используемые ресурсы.
        /// </summary>
        ~Def()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::TextBox^  tObj;
    protected:
    private: int click;
    private: Devart::Data::MySql::MySqlDataReader^  MySqlDataReader1;
    private: System::Windows::Forms::Button^  bSizeMinus;
    private: System::Windows::Forms::Button^  bStart;
    private: System::Windows::Forms::Button^  bSizePlus;
    private: System::Windows::Forms::Label^  lOut;
    private: System::Windows::Forms::Label^  lIn;
    private: System::Windows::Forms::NumericUpDown^  attIn;
    private: System::Windows::Forms::Label^  lPhase;
    private: System::Windows::Forms::Timer^  timer1;
    private: System::Windows::Forms::Label^  lObj;
    private: System::Windows::Forms::NumericUpDown^  attOut;
    private: System::Windows::Forms::Label^  lf;
    private: System::Windows::Forms::Label^  lAmp;
    private: System::Windows::Forms::Button^  bResize;
    private: System::Windows::Forms::Label^  lSettings;
    private: System::Windows::Forms::TextBox^  tf1;
    private: System::Windows::Forms::TextBox^  tPhase1;
    private: System::Windows::Forms::TextBox^  tAmp1;
    private: System::Windows::Forms::TrackBar^  fBar1;
    private: System::Windows::Forms::TrackBar^  phaseBar1;
    private: System::Windows::Forms::SplitContainer^  splitContainer1;
    private: ZedGraph::ZedGraphControl^  zedGraphControl3;
    private: ZedGraph::ZedGraphControl^  zedGraphControl2;
    private: ZedGraph::ZedGraphControl^  zedGraphControl1;
private: System::Windows::Forms::Label^  lCanal;
private: Devart::Data::MySql::MySqlConnection^  mySqlConnection1;
private: Devart::Data::MySql::MySqlCommand^  mySqlCommand1;
private: System::Windows::Forms::Label^  label2;
private: System::Windows::Forms::TrackBar^  trackBar1;
private: System::Windows::Forms::Label^  lObject;
private: System::Windows::Forms::Label^  lBase;
private: System::Windows::Forms::Button^  bStop;
private: System::Windows::Forms::Button^  bBalance;
private: System::Windows::Forms::Button^  bFilt;

    private: System::ComponentModel::IContainer^  components;

    private:
        /// <summary>
        /// Требуется переменная конструктора.
        /// </summary>

#pragma region Windows Form Designer generated code
        /// <summary>
        /// Обязательный метод для поддержки конструктора — не изменяйте
        /// содержимое данного метода при помощи редактора кода.
        /// </summary>
        void InitializeComponent(void)
        {
            this>components = (gcnew System::ComponentModel::Container());
            System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Def::typeid));
            this>tObj = (gcnew System::Windows::Forms::TextBox());
            this>bSizeMinus = (gcnew System::Windows::Forms::Button());
            this>bStart = (gcnew System::Windows::Forms::Button());
            this>bSizePlus = (gcnew System::Windows::Forms::Button());
            this>lOut = (gcnew System::Windows::Forms::Label());
            this>lIn = (gcnew System::Windows::Forms::Label());
            this>attIn = (gcnew System::Windows::Forms::NumericUpDown());
            this>lPhase = (gcnew System::Windows::Forms::Label());
            this>timer1 = (gcnew System::Windows::Forms::Timer(this>components));
            this>lObj = (gcnew System::Windows::Forms::Label());
            this>attOut = (gcnew System::Windows::Forms::NumericUpDown());
            this>lf = (gcnew System::Windows::Forms::Label());
            this>lAmp = (gcnew System::Windows::Forms::Label());
            this>bResize = (gcnew System::Windows::Forms::Button());
            this>lSettings = (gcnew System::Windows::Forms::Label());
            this>tf1 = (gcnew System::Windows::Forms::TextBox());
            this>tPhase1 = (gcnew System::Windows::Forms::TextBox());
            this>tAmp1 = (gcnew System::Windows::Forms::TextBox());
            this>fBar1 = (gcnew System::Windows::Forms::TrackBar());
            this>phaseBar1 = (gcnew System::Windows::Forms::TrackBar());
            this>splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());
            this>bFilt = (gcnew System::Windows::Forms::Button());
            this>bBalance = (gcnew System::Windows::Forms::Button());
            this>bStop = (gcnew System::Windows::Forms::Button());
            this>lBase = (gcnew System::Windows::Forms::Label());
            this>trackBar1 = (gcnew System::Windows::Forms::TrackBar());
            this>label2 = (gcnew System::Windows::Forms::Label());
            this>lCanal = (gcnew System::Windows::Forms::Label());
            this>zedGraphControl3 = (gcnew ZedGraph::ZedGraphControl());
            this>zedGraphControl2 = (gcnew ZedGraph::ZedGraphControl());
            this>zedGraphControl1 = (gcnew ZedGraph::ZedGraphControl());
            this>lObject = (gcnew System::Windows::Forms::Label());
            this>mySqlConnection1 = (gcnew Devart::Data::MySql::MySqlConnection());
            this>mySqlCommand1 = (gcnew Devart::Data::MySql::MySqlCommand());
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>attIn))>BeginInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>attOut))>BeginInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>fBar1))>BeginInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>phaseBar1))>BeginInit();
            this>splitContainer1>Panel1>SuspendLayout();
            this>splitContainer1>Panel2>SuspendLayout();
            this>splitContainer1>SuspendLayout();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>trackBar1))>BeginInit();
            this>SuspendLayout();
            //
            // tObj
            //
            this>tObj>Location = System::Drawing::Point(537, 14);
            this>tObj>Name = L«tObj»;
            this>tObj>Size = System::Drawing::Size(201, 20);
            this>tObj>TabIndex = 33;
            //
            // bSizeMinus
            //
            this>bSizeMinus>Font = (gcnew System::Drawing::Font(L«Microsoft Sans Serif», 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this>bSizeMinus>Location = System::Drawing::Point(472, 95);
            this>bSizeMinus>Name = L«bSizeMinus»;
            this>bSizeMinus>Size = System::Drawing::Size(34, 34);
            this>bSizeMinus>TabIndex = 32;
            this>bSizeMinus>Text = L«-«;
            this>bSizeMinus>UseVisualStyleBackColor = true;
            this>bSizeMinus>Click += gcnew System::EventHandler(this, &Def::bSizeMinus_Click);
            //
            // bStart
            //
            this>bStart>BackColor = System::Drawing::SystemColors::ButtonHighlight;
            this>bStart>Location = System::Drawing::Point(432, 33);
            this>bStart>Name = L«bStart»;
            this>bStart>Size = System::Drawing::Size(74, 25);
            this>bStart>TabIndex = 30;
            this>bStart>Text = L«СТАРТ»;
            this>bStart>UseVisualStyleBackColor = true;
            this>bStart>Click += gcnew System::EventHandler(this, &Def::bStart_Click);
            //
            // bSizePlus
            //
            this>bSizePlus>Font = (gcnew System::Drawing::Font(L«Microsoft Sans Serif», 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(204)));
            this>bSizePlus>Location = System::Drawing::Point(432, 95);
            this>bSizePlus>Name = L«bSizePlus»;
            this>bSizePlus>Size = System::Drawing::Size(34, 34);
            this>bSizePlus>TabIndex = 31;
            this>bSizePlus>Text = L«+»;
            this>bSizePlus>UseVisualStyleBackColor = true;
            this>bSizePlus>Click += gcnew System::EventHandler(this, &Def::bSizePlus_Click);
            //
            // lOut
            //
            this>lOut>AutoSize = true;
            this>lOut>Location = System::Drawing::Point(32, 95);
            this>lOut>Name = L«lOut»;
            this>lOut>Size = System::Drawing::Size(39, 13);
            this>lOut>TabIndex = 33;
            this>lOut>Text = L«Выход»;
            //
            // lIn
            //
            this>lIn>AutoSize = true;
            this>lIn>Location = System::Drawing::Point(32, 56);
            this>lIn>Name = L«lIn»;
            this>lIn>Size = System::Drawing::Size(31, 13);
            this>lIn>TabIndex = 32;
            this>lIn>Text = L«Вход»;
            //
            // attIn
            //
            this>attIn>Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {3, 0, 0, 0});
            this>attIn>Location = System::Drawing::Point(29, 72);
            this>attIn>Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {45, 0, 0, 0});
            this>attIn>Name = L«attIn»;
            this>attIn>Size = System::Drawing::Size(45, 20);
            this>attIn>TabIndex = 30;
            this>attIn>ValueChanged += gcnew System::EventHandler(this, &Def::attIn_ValueChanged);
            //
            // lPhase
            //
            this>lPhase>AutoSize = true;
            this>lPhase>Location = System::Drawing::Point(83, 17);
            this>lPhase>Name = L«lPhase»;
            this>lPhase>Size = System::Drawing::Size(36, 13);
            this>lPhase>TabIndex = 28;
            this>lPhase>Text = L«Фаза»;
            //
            // timer1
            //
            this>timer1>Interval = 1;
            this>timer1>Tick += gcnew System::EventHandler(this, &Def::timer1_Tick);
            //
            // lObj
            //
            this>lObj>AutoSize = true;
            this>lObj>Location = System::Drawing::Point(426, 5);
            this>lObj>Name = L«lObj»;
            this>lObj>Size = System::Drawing::Size(105, 26);
            this>lObj>TabIndex = 34;
            this>lObj>Text = L«Название объекта rnдефектоскопии:»;
            //
            // attOut
            //
            this>attOut>Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {3, 0, 0, 0});
            this>attOut>Location = System::Drawing::Point(29, 109);
            this>attOut>Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {45, 0, 0, 0});
            this>attOut>Name = L«attOut»;
            this>attOut>Size = System::Drawing::Size(45, 20);
            this>attOut>TabIndex = 31;
            this>attOut>ValueChanged += gcnew System::EventHandler(this, &Def::attOut_ValueChanged);
            //
            // lf
            //
            this>lf>AutoSize = true;
            this>lf>Location = System::Drawing::Point(128, 17);
            this>lf>Name = L«lf»;
            this>lf>Size = System::Drawing::Size(49, 13);
            this>lf>TabIndex = 29;
            this>lf>Text = L«Частота»;
            //
            // lAmp
            //
            this>lAmp>AutoSize = true;
            this>lAmp>Location = System::Drawing::Point(26, 17);
            this>lAmp>Name = L«lAmp»;
            this>lAmp>Size = System::Drawing::Size(62, 13);
            this>lAmp>TabIndex = 27;
            this>lAmp>Text = L«Амплитуда»;
            //
            // bResize
            //
            this>bResize>Location = System::Drawing::Point(3, 3);
            this>bResize>Name = L«bResize»;
            this>bResize>Size = System::Drawing::Size(22, 22);
            this>bResize>TabIndex = 26;
            this>bResize>Text = L«>»;
            this>bResize>UseVisualStyleBackColor = true;
            this>bResize>Click += gcnew System::EventHandler(this, &Def::bResize_Click);
            //
            // lSettings
            //
            this>lSettings>AutoSize = true;
            this>lSettings>Location = System::Drawing::Point(3, 25);
            this>lSettings>Name = L«lSettings»;
            this>lSettings>Size = System::Drawing::Size(15, 117);
            this>lSettings>TabIndex = 25;
            this>lSettings>Text = L«НrnАrnСrnТrnРrnОrnЙrnКrnИ»;
            this>lSettings>TextAlign = System::Drawing::ContentAlignment::TopCenter;
            //
            // tf1
            //
            this>tf1>Location = System::Drawing::Point(131, 33);
            this>tf1>Name = L«tf1»;
            this>tf1>Size = System::Drawing::Size(45, 20);
            this>tf1>TabIndex = 24;
            this>tf1>Text = L«500»;
            this>tf1>TextChanged += gcnew System::EventHandler(this, &Def::tf1_TextChanged);
            //
            // tPhase1
            //
            this>tPhase1>Location = System::Drawing::Point(80, 33);
            this>tPhase1>Name = L«tPhase1»;
            this>tPhase1>Size = System::Drawing::Size(45, 20);
            this>tPhase1>TabIndex = 23;
            this>tPhase1>Text = L«0»;
            this>tPhase1>TextChanged += gcnew System::EventHandler(this, &Def::tPhase1_TextChanged);
            //
            // tAmp1
            //
            this>tAmp1>Location = System::Drawing::Point(29, 33);
            this>tAmp1>Name = L«tAmp1»;
            this>tAmp1>Size = System::Drawing::Size(45, 20);
            this>tAmp1>TabIndex = 22;
            this>tAmp1>Text = L«0»;
            this>tAmp1>TextChanged += gcnew System::EventHandler(this, &Def::tAmp1_TextChanged);
            //
            // fBar1
            //
            this>fBar1>Location = System::Drawing::Point(131, 60);
            this>fBar1>Maximum = 1000;
            this>fBar1>Minimum = 10;
            this>fBar1>Name = L«fBar1»;
            this>fBar1>Orientation = System::Windows::Forms::Orientation::Vertical;
            this>fBar1>Size = System::Drawing::Size(45, 260);
            this>fBar1>TabIndex = 21;
            this>fBar1>TickStyle = System::Windows::Forms::TickStyle::Both;
            this>fBar1>Value = 500;
            this>fBar1>Scroll += gcnew System::EventHandler(this, &Def::fBar1_Scroll);
            //
            // phaseBar1
            //
            this>phaseBar1>Location = System::Drawing::Point(80, 60);
            this>phaseBar1>Maximum = 3600;
            this>phaseBar1>Name = L«phaseBar1»;
            this>phaseBar1>Orientation = System::Windows::Forms::Orientation::Vertical;
            this>phaseBar1>Size = System::Drawing::Size(45, 260);
            this>phaseBar1>TabIndex = 20;
            this>phaseBar1>TickStyle = System::Windows::Forms::TickStyle::Both;
            this>phaseBar1>Scroll += gcnew System::EventHandler(this, &Def::phaseBar1_Scroll);
            //
            // splitContainer1
            //
            this>splitContainer1>Dock = System::Windows::Forms::DockStyle::Fill;
            this>splitContainer1>Location = System::Drawing::Point(0, 0);
            this>splitContainer1>Name = L«splitContainer1»;
            //
            // splitContainer1.Panel1
            //
            this>splitContainer1>Panel1>Controls>Add(this>lOut);
            this>splitContainer1>Panel1>Controls>Add(this>lIn);
            this>splitContainer1>Panel1>Controls>Add(this>attOut);
            this>splitContainer1>Panel1>Controls>Add(this>attIn);
            this>splitContainer1>Panel1>Controls>Add(this>lf);
            this>splitContainer1>Panel1>Controls>Add(this>lPhase);
            this>splitContainer1>Panel1>Controls>Add(this>lAmp);
            this>splitContainer1>Panel1>Controls>Add(this>bResize);
            this>splitContainer1>Panel1>Controls>Add(this>lSettings);
            this>splitContainer1>Panel1>Controls>Add(this>tf1);
            this>splitContainer1>Panel1>Controls>Add(this>tPhase1);
            this>splitContainer1>Panel1>Controls>Add(this>tAmp1);
            this>splitContainer1>Panel1>Controls>Add(this>fBar1);
            this>splitContainer1>Panel1>Controls>Add(this>phaseBar1);
            this>splitContainer1>Panel1MinSize = 28;
            //
            // splitContainer1.Panel2
            //
            this>splitContainer1>Panel2>BackColor = System::Drawing::Color::PaleTurquoise;
            this>splitContainer1>Panel2>Controls>Add(this>bFilt);
            this>splitContainer1>Panel2>Controls>Add(this>bBalance);
            this>splitContainer1>Panel2>Controls>Add(this>bStop);
            this>splitContainer1>Panel2>Controls>Add(this>lBase);
            this>splitContainer1>Panel2>Controls>Add(this>trackBar1);
            this>splitContainer1>Panel2>Controls>Add(this>label2);
            this>splitContainer1>Panel2>Controls>Add(this>lCanal);
            this>splitContainer1>Panel2>Controls>Add(this>zedGraphControl3);
            this>splitContainer1>Panel2>Controls>Add(this>zedGraphControl2);
            this>splitContainer1>Panel2>Controls>Add(this>zedGraphControl1);
            this>splitContainer1>Panel2>Controls>Add(this>lObj);
            this>splitContainer1>Panel2>Controls>Add(this>tObj);
            this>splitContainer1>Panel2>Controls>Add(this>bSizeMinus);
            this>splitContainer1>Panel2>Controls>Add(this>bSizePlus);
            this>splitContainer1>Panel2>Controls>Add(this>bStart);
            this>splitContainer1>Panel2>Controls>Add(this>lObject);
            this>splitContainer1>Size = System::Drawing::Size(924, 555);
            this>splitContainer1>SplitterDistance = 28;
            this>splitContainer1>TabIndex = 5;
            //
            // bFilt
            //
            this>bFilt>Location = System::Drawing::Point(432, 135);
            this>bFilt>Name = L«bFilt»;
            this>bFilt>Size = System::Drawing::Size(72, 23);
            this>bFilt>TabIndex = 45;
            this>bFilt>Text = L«Фильтр»;
            this>bFilt>UseVisualStyleBackColor = true;
            this>bFilt>Click += gcnew System::EventHandler(this, &Def::bFilt_Click);
            //
            // bBalance
            //
            this>bBalance>Location = System::Drawing::Point(432, 164);
            this>bBalance>Name = L«bBalance»;
            this>bBalance>Size = System::Drawing::Size(73, 23);
            this>bBalance>TabIndex = 44;
            this>bBalance>Text = L«Баланс»;
            this>bBalance>UseVisualStyleBackColor = true;
            this>bBalance>Click += gcnew System::EventHandler(this, &Def::bBalance_Click);
            //
            // bStop
            //
            this>bStop>BackColor = System::Drawing::SystemColors::ButtonHighlight;
            this>bStop>Location = System::Drawing::Point(432, 64);
            this>bStop>Name = L«bStop»;
            this>bStop>Size = System::Drawing::Size(74, 25);
            this>bStop>TabIndex = 43;
            this>bStop>Text = L«СТОП»;
            this>bStop>UseVisualStyleBackColor = true;
            this>bStop>Click += gcnew System::EventHandler(this, &Def::bStop_Click);
            //
            // lBase
            //
            this>lBase>AutoSize = true;
            this>lBase>Location = System::Drawing::Point(565, 99);
            this>lBase>Name = L«lBase»;
            this>lBase>Size = System::Drawing::Size(33, 13);
            this>lBase>TabIndex = 42;
            this>lBase>Text = L«lBase»;
            this>lBase>Visible = false;
            //
            // trackBar1
            //
            this>trackBar1>BackColor = System::Drawing::Color::PaleTurquoise;
            this>trackBar1>Location = System::Drawing::Point(3, 498);
            this>trackBar1>Name = L«trackBar1»;
            this>trackBar1>Size = System::Drawing::Size(666, 45);
            this>trackBar1>TabIndex = 40;
            this>trackBar1>TickStyle = System::Windows::Forms::TickStyle::None;
            this>trackBar1>Visible = false;
            this>trackBar1>Scroll += gcnew System::EventHandler(this, &Def::trackBar1_Scroll);
            //
            // label2
            //
            this>label2>AutoSize = true;
            this>label2>Location = System::Drawing::Point(564, 81);
            this>label2>Name = L«label2»;
            this>label2>Size = System::Drawing::Size(35, 13);
            this>label2>TabIndex = 39;
            this>label2>Text = L«label1»;
            this>label2>Visible = false;
            //
            // lCanal
            //
            this>lCanal>AutoSize = true;
            this>lCanal>Location = System::Drawing::Point(564, 62);
            this>lCanal>Name = L«lCanal»;
            this>lCanal>Size = System::Drawing::Size(35, 13);
            this>lCanal>TabIndex = 38;
            this>lCanal>Text = L«label1»;
            this>lCanal>Visible = false;
            //
            // zedGraphControl3
            //
            this>zedGraphControl3>Location = System::Drawing::Point(429, 246);
            this>zedGraphControl3>Name = L«zedGraphControl3»;
            this>zedGraphControl3>ScrollGrace = 0;
            this>zedGraphControl3>ScrollMaxX = 0;
            this>zedGraphControl3>ScrollMaxY = 0;
            this>zedGraphControl3>ScrollMaxY2 = 0;
            this>zedGraphControl3>ScrollMinX = 0;
            this>zedGraphControl3>ScrollMinY = 0;
            this>zedGraphControl3>ScrollMinY2 = 0;
            this>zedGraphControl3>Size = System::Drawing::Size(240, 240);
            this>zedGraphControl3>TabIndex = 37;
            //
            // zedGraphControl2
            //
            this>zedGraphControl2>Location = System::Drawing::Point(3, 246);
            this>zedGraphControl2>Name = L«zedGraphControl2»;
            this>zedGraphControl2>ScrollGrace = 0;
            this>zedGraphControl2>ScrollMaxX = 0;
            this>zedGraphControl2>ScrollMaxY = 0;
            this>zedGraphControl2>ScrollMaxY2 = 0;
            this>zedGraphControl2>ScrollMinX = 0;
            this>zedGraphControl2>ScrollMinY = 0;
            this>zedGraphControl2>ScrollMinY2 = 0;
            this>zedGraphControl2>Size = System::Drawing::Size(420, 240);
            this>zedGraphControl2>TabIndex = 36;
            //
            // zedGraphControl1
            //
            this>zedGraphControl1>Location = System::Drawing::Point(3, 5);
            this>zedGraphControl1>Name = L«zedGraphControl1»;
            this>zedGraphControl1>ScrollGrace = 0;
            this>zedGraphControl1>ScrollMaxX = 0;
            this>zedGraphControl1>ScrollMaxY = 0;
            this>zedGraphControl1>ScrollMaxY2 = 0;
            this>zedGraphControl1>ScrollMinX = 0;
            this>zedGraphControl1>ScrollMinY = 0;
            this>zedGraphControl1>ScrollMinY2 = 0;
            this>zedGraphControl1>Size = System::Drawing::Size(420, 240);
            this>zedGraphControl1>TabIndex = 35;
            //
            // lObject
            //
            this>lObject>AutoSize = true;
            this>lObject>Location = System::Drawing::Point(537, 18);
            this>lObject>Name = L«lObject»;
            this>lObject>Size = System::Drawing::Size(0, 13);
            this>lObject>TabIndex = 41;
            //
            // mySqlConnection1
            //
            this>mySqlConnection1>ConnectionString = L«User Id=root;Host=localhost;Database=fazus_db;»;
            this>mySqlConnection1>Name = L«mySqlConnection1»;
            //
            // mySqlCommand1
            //
            this>mySqlCommand1>Connection = this>mySqlConnection1;
            this>mySqlCommand1>Name = L«mySqlCommand1»;
            //
            // Def
            //
            this>AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this>AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this>BackColor = System::Drawing::Color::PaleTurquoise;
            this>ClientSize = System::Drawing::Size(924, 555);
            this>Controls>Add(this>splitContainer1);
            this>Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources>GetObject(L«$this.Icon»)));
            this>Name = L«Def»;
            this>Text = L«Def»;
            this>Load += gcnew System::EventHandler(this, &Def::Def_Load);
            this>VisibleChanged += gcnew System::EventHandler(this, &Def::Def_Load);
            this>FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Def::Def_FormClosing);
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>attIn))>EndInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>attOut))>EndInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>fBar1))>EndInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>phaseBar1))>EndInit();
            this>splitContainer1>Panel1>ResumeLayout(false);
            this>splitContainer1>Panel1>PerformLayout();
            this>splitContainer1>Panel2>ResumeLayout(false);
            this>splitContainer1>Panel2>PerformLayout();
            this>splitContainer1>ResumeLayout(false);
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this>trackBar1))>EndInit();
            this>ResumeLayout(false);

        }
#pragma endregion
    private: System::Void Def_Load(System::Object^  sender, System::EventArgs^  e) {
            tPhase1>Text=Convert::ToString((float)phaseBar1>Value/10);
            tf1>Text=Convert::ToString(fBar1>Value);
            click=0;
/*          fd_set soc_insp;
            timeval insp_time;
            soc_insp.fd_count = 1;
            soc_insp.fd_array[0] = m_sock;
            insp_time.tv_sec = 0;
            insp_time.tv_usec = 10000*2;*/

/*          init_program();
            init_instrument();
            select(0, &soc_insp, NULL, NULL, &insp_time);
            this->Name;*/

            if(this>Name==«Can0») {
                Canal=0;
                lCanal>Text=«0»;
                this>Text=«Дефектоскопия, канал 1»;
            }
            if(this>Name==«Can1») {
                Canal=1;
                lCanal>Text=«1»;
                this>Text=«Дефектоскопия, канал 2»;
            }
            if(this>Name==«Can2») {
                Canal=2;
                lCanal>Text=«2»;
                this>Text=«Дефектоскопия, канал 3»;
            }
            if(this>Name==«Can3») {
                Canal=3;
                lCanal>Text=«3»;
                this>Text=«Дефектоскопия, канал 4»;
            }
            if(this>Name!=«Can0»&&this>Name!=«Can1»&&this>Name!=«Can2»&&this>Name!=«Can3») {
                Canal=99;
                l2[4]=0;
                trackBar1>Value=(int)l2[4];
                lCanal>Text=«4»;
                bBalance>Visible=false;
                lBase>Text=this>Name;
                tObj>Visible=false;
                bResize>Visible=false;
                lSettings>Visible=false;
                bFilt>Visible=false;
                this>Text=«Дефектоскопия, архив»;
                trackBar1>Visible=true;

               
                mySqlCommand1>CommandText=«select X from`»+lBase>Text+«`;»;
                mySqlConnection1>Open();
                MySqlDataReader1 = mySqlCommand1>ExecuteReader();
                while(MySqlDataReader1>Read())
                {
                }
                trackBar1>Maximum=Convert::ToInt16(MySqlDataReader1>RecordCount::get());
                mySqlCommand1>CommandText=«select `obj` from`obj` where `database`='»+lBase>Text+«‘;»;
                MySqlDataReader1 = mySqlCommand1>ExecuteReader();
                    while(MySqlDataReader1>Read())
                    {
                    for (int i = 0; i < MySqlDataReader1>FieldCount; i++)
                    {
                    lObject>Text=MySqlDataReader1>GetValue(i)>ToString();
                    }
                }
                mySqlConnection1>Close();
            }
            canalOpen[Convert::ToInt32(lCanal>Text)]=false;
            this>Load_Graw();
             }
private: System::Void tAmp1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
             set_generator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_compensator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_amp(Convert::ToInt32(attIn>Text)/3,Convert::ToInt32(attOut>Text)/3,Convert::ToInt32(lCanal>Text));
             set_frequency(fBar1>Value,1,Convert::ToInt32(lCanal>Text));
         }
private: System::Void tf1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
             fBar1>Value=Convert::ToInt32(tf1>Text);
             set_frequency(fBar1>Value,1,Convert::ToInt32(lCanal>Text));

         }
private: System::Void tPhase1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
             set_generator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_compensator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_amp(Convert::ToInt32(attIn>Text)/3,Convert::ToInt32(attOut>Text)/3,Convert::ToInt32(lCanal>Text));
             set_frequency(fBar1>Value,1,Convert::ToInt32(lCanal>Text));
         }
private: System::Void phaseBar1_Scroll(System::Object^  sender, System::EventArgs^  e) {
             tPhase1>Text=Convert::ToString((float)phaseBar1>Value/10);
         }
private: System::Void fBar1_Scroll(System::Object^  sender, System::EventArgs^  e) {
             tf1>Text=Convert::ToString(fBar1>Value);
         }

private: System::Void bResize_Click(System::Object^  sender, System::EventArgs^  e) {
                 click++;
                 if(click%2){
                     splitContainer1>SplitterDistance=tf1>Width+tf1>Left+3;
                     bResize>Text=«<«;
                 }
                 else{
                     splitContainer1>SplitterDistance=bResize>Width;
                     bResize>Text=«>»;
                 }

         }
private: System::Void attIn_ValueChanged(System::Object^  sender, System::EventArgs^  e) {
             tAmp1>Text=Convert::ToString(get_amp1());
             set_generator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_compensator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_amp(Convert::ToInt32(attIn>Text)/3,Convert::ToInt32(attOut>Text)/3,Convert::ToInt32(lCanal>Text));
         }
private: System::Void attOut_ValueChanged(System::Object^  sender, System::EventArgs^  e) {
             tAmp1>Text=Convert::ToString(get_amp1());
             set_generator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_compensator(phaseBar1>Value,Convert::ToInt32(tAmp1>Text),Convert::ToInt32(lCanal>Text));
             set_amp(Convert::ToInt32(attIn>Text)/3,Convert::ToInt32(attOut>Text)/3,Convert::ToInt32(lCanal>Text));
         }
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
             if(this>Name!=«Can0»&&this>Name!=«Can1»&&this>Name!=«Can2»&&this>Name!=«Can3»)
             {//алгоритм вывода из базы
                if(lObject>Text!=«»){
                int z;
                l2[4]=trackBar1>Value;
                if(trackBar1>Value<64){
                    z=0;
                }
                else{
                    z=trackBar1>Value64;
                }
                timer1>Interval=42;
                //timer1->Interval=65;
                //timer1->Interval=1;
                l2[4]=++l2[4];
                trackBar1>Value=Convert::ToInt32(l2[4]);
                if(l2[4]>trackBar1>Maximum2){
                            timer1>Enabled=false;
                        }      
                mySqlCommand1>CommandText = «select `X` from`»+lBase>Text+«` where `id`=»+trackBar1>Value+«;»;
                mySqlConnection1>Open();
                MySqlDataReader1 = mySqlCommand1>ExecuteReader();
                while(MySqlDataReader1>Read())
                {
                    for (int i = 0; i < MySqlDataReader1>FieldCount; i++)
                    {
                        l1=Convert::ToDouble(MySqlDataReader1>GetValue(i)>ToString());
                        if(l2[4]>trackBar1>Maximum2){
                            break;
                            timer1>Enabled=false;
                        }
                        per++;
                        if(per>=64){
                        per=0;};
                        if(l1>t) t=t+2.5;
                        if(l3>t) t=t+2.5;
                        if(l1<t) t=t+2.5;
                        if(l3<t) t=t+2.5;
                    }
                }
                mySqlCommand1>CommandText = «select `Y` from`»+lBase>Text+«` where `id`=»+trackBar1>Value+«;»;
                mySqlConnection1>Open();
                MySqlDataReader1 = mySqlCommand1>ExecuteReader();
                while(MySqlDataReader1>Read())
                {
                    for (int i = 0; i < MySqlDataReader1>FieldCount; i++)
                    {
                        l3=Convert::ToDouble(MySqlDataReader1>GetValue(i)>ToString());
                        if(l2[4]>trackBar1>Maximum2){
                            break;
                            timer1>Enabled=false;
                        }
                        per++;
                        if(per>=64){
                        per=0;};
                        if(l1>t) t=t+2.5;
                        if(l3>t) t=t+2.5;
                        if(l1<t) t=t+2.5;
                        if(l3<t) t=t+2.5;
                    }
                }
                Load_Graw();
                Graw_Draw();
                mySqlConnection1>Close();
             }
             }
             else
             {
                     l1=coordX[Convert::ToInt32(lCanal>Text)][per]/1000;
                     l3=coordY[Convert::ToInt32(lCanal>Text)][per]/1000;
                     this>Load_Graw();
                     this>Graw_Draw();
                     l2[Convert::ToInt32(lCanal>Text)]=++l2[Convert::ToInt32(lCanal>Text)];
                     mySqlCommand1>CommandText = «insert into `»+label2>Text+«`(`X`,`Y`) values (‘»+Convert::ToString(l1)+«‘,'»+Convert::ToString(l3)+«‘);»;
                     mySqlConnection1>Open();
                     mySqlCommand1>ExecuteNonQuery();
                     per++;
                     if(per>=64){
                     per=0;};
                     if(l1>t) t=t+2.5;
                     if(l3>t) t=t+2.5;
                     if(l1<t) t=t+2.5;
                     if(l3<t) t=t+2.5;
             }

           
           
         }
private: System::Void bStart_Click(System::Object^  sender, System::EventArgs^  e) {
            if((tObj>Text!=«»)&&(tObj>Text!=«Enter the name of the object inspection»)&&(this>Name==«Can0»||this>Name==«Can1»||this>Name==«Can2»||this>Name==«Can3»)){
                timer1>Interval=1;
            DateTime date1;
            date1=DateTime::Now;
            mySqlCommand1>CommandText = «create table `»+Convert::ToString(date1.Day)+«_»+Convert::ToString(date1.Month)+«_»+Convert::ToString(date1.Year)+«_»+Convert::ToString(date1.Hour)+«_»+Convert::ToString(date1.Minute)+«_»+Convert::ToString(date1.Second)+«`(`ID` int(10) AUTO_INCREMENT,`X` char(10),`Y` char(10), `step` int(10), PRIMARY KEY(`ID`));»;
            mySqlConnection1>Open();
            label2>Text=Convert::ToString(date1.Day)+«_»+Convert::ToString(date1.Month)+«_»+Convert::ToString(date1.Year)+«_»+Convert::ToString(date1.Hour)+«_»+Convert::ToString(date1.Minute)+«_»+Convert::ToString(date1.Second);
            mySqlCommand1>ExecuteNonQuery();
            mySqlCommand1>CommandText = «insert into `obj`(`OBJ`,`database`) values (‘»+tObj>Text+«‘,'»+label2>Text+«‘);»;
            mySqlCommand1>ExecuteNonQuery();
            timer1>Enabled=true;
            mySqlConnection1>Close();
            }
            else
            {
                tObj>Text=«Enter the name of the object inspection»;
            }
            if((lObject>Text!=«»)&&(trackBar1>Value<trackBar1>Maximum2)){
            timer1>Enabled=true;
            l2[4]=trackBar1>Value;
            }
/*          if(lObject->Text!=»»){
                int z;
                l2[4]=trackBar1->Value;
                if(trackBar1->Value<64){
                    z=0;
                }
                else{
                    z=trackBar1->Value-64;
                }
                mySqlCommand1->CommandText = «select `X` from`»+lBase->Text+»` where `id`<«+trackBar1->Value+» and `id`>=»+z+»;»;
                mySqlConnection1->Open();
                MySqlDataReader1 = mySqlCommand1->ExecuteReader();
                while(MySqlDataReader1->Read())
                {
                    for (int i = 0; i < MySqlDataReader1->FieldCount; i++)
                    {
                        l1=Convert::ToDouble(MySqlDataReader1->GetValue(i)->ToString());
                        l2[4]=++l2[4];
                        trackBar1->Value=Convert::ToInt32(l2[4]);
                        per++;
                        if(per>=64){
                        per=0;};
                        if(l1>t) t=t+2.5;
                        if(l3>t) t=t+2.5;
                        if(l1<-t) t=t+2.5;
                        if(l3<-t) t=t+2.5;
                    }
                }
            mySqlConnection1->Close();
            timer1->Enabled=true;*/

        //  }
         }
private: System::Void bSizePlus_Click(System::Object^  sender, System::EventArgs^  e) {
             t=t2.5;
         }
private: System::Void bSizeMinus_Click(System::Object^  sender, System::EventArgs^  e) {
             t=t+2.5;
         }
private: System::Void trackBar1_Scroll(System::Object^  sender, System::EventArgs^  e) {
             if(!timer1>Enabled){
                int z;
                l2[4]=trackBar1>Value;
                if(trackBar1>Value<64){
                    z=0;
                }
                else{
                    z=trackBar1>Value64;
                }
                l2[4]=++l2[4];
                mySqlCommand1>CommandText = «select `X` from`»+lBase>Text+«` where `id`<«+trackBar1>Value+» and `id`>»+z+«;»;
                mySqlConnection1>Open();
                MySqlDataReader1 = mySqlCommand1>ExecuteReader();
                while(MySqlDataReader1>Read())
                {
                    for (int i = 0; i < MySqlDataReader1>FieldCount; i++)
                    {
                        l1=Convert::ToDouble(MySqlDataReader1>GetValue(i)>ToString());
                        per++;
                        if(per>=64){
                        per=0;};
                        if(l1>t) t=t+2.5;
                        if(l3>t) t=t+2.5;
                        if(l1<t) t=t+2.5;
                        if(l3<t) t=t+2.5;
                    }
                }
                mySqlCommand1>CommandText = «select `Y` from`»+lBase>Text+«` where `id`=»+trackBar1>Value+«;»;
                mySqlConnection1>Open();
                MySqlDataReader1 = mySqlCommand1>ExecuteReader();
                while(MySqlDataReader1>Read())
                {
                    for (int i = 0; i < MySqlDataReader1>FieldCount; i++)
                    {
                        l3=Convert::ToDouble(MySqlDataReader1>GetValue(i)>ToString());
                        per++;
                        if(per>=64){
                        per=0;};
                        if(l1>t) t=t+2.5;
                        if(l3>t) t=t+2.5;
                        if(l1<t) t=t+2.5;
                        if(l3<t) t=t+2.5;
                    }
                }
                Load_Graw();
                Graw_Draw();
                mySqlConnection1>Close();
                }
         }
private: System::Void bStop_Click(System::Object^  sender, System::EventArgs^  e) {
             timer1>Enabled=false;
         }
private: System::Void bBalance_Click(System::Object^  sender, System::EventArgs^  e) {
                balance(Convert::ToInt32(lCanal>Text));
         }
private: System::Void bFilt_Click(System::Object^  sender, System::EventArgs^  e) {
             filt1^ gfilt = gcnew filt1;
             gfilt>Show();
         }
private: System::Void Def_FormClosing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) {
             canalOpen[Convert::ToInt32(lCanal>Text)]=true;
         }
};
}
//Convert::ToInt32(lCanal)
/*          mySqlInsertData->CommandText = «insert into `»+label2->Text+»`(`X`,`Y`, `step`) values (‘»+textBox1->Text+»‘,'»+textBox2->Text+»‘,'»+textBox3->Text+»‘);»;
            label1->Text=mySqlInsertData->CommandText;
            mySqlInsertData->ExecuteNonQuery();
*/

Понравилась статья? Поделить с друзьями:
  • Error lnk2001 неразрешенный внешний символ cxxframehandler3
  • Error lnk2001 unresolved external symbol winmain 16
  • Error lnk2001 unresolved external symbol purecall
  • Error lnk2001 unresolved external symbol public
  • Error lnk2001 unresolved external symbol main