Ошибка точка входа должна быть определена

Что означает эта ошибка? 1> LINK : не найден или не выполнена сборка c:userscsdocumentsvisual studio 2010ProjectsролролглDebugVwe.exe при последней инкрементной компоновке; выполняется

Что означает эта ошибка?

1> LINK : не найден или не выполнена сборка c:userscsdocumentsvisual studio 2010ProjectsролролглDebugVwe.exe при последней инкрементной компоновке; выполняется полная компоновка
1>LINK : fatal error LNK1561: точка входа должна быть определена

Nicolas Chabanovsky's user avatar

задан 22 фев 2012 в 17:29

RconPro's user avatar

Возможно вы создали пустой проект, пользуясь мастером Visual Studio, и пытаетесь его скомпилировать и слинковать. А так как он не имеет метода main (для консольного приложения) и т.п., то сборщик и сообщает об ошибке.

Либо используйте другой шаблон проекта, либо добавьте в проект файл содержащий точку входа.

ответ дан 22 фев 2012 в 17:46

stanislav's user avatar

stanislavstanislav

34.1k25 золотых знаков95 серебряных знаков212 бронзовых знаков

Правая кнопка мыши на Проект -> Свойства -> Компоновщик -> Все параметры -> Подсистема.
Выберите — «Консоль».
Также не забудьте о main();

Denis's user avatar

Denis

8,84010 золотых знаков29 серебряных знаков54 бронзовых знака

ответ дан 12 мая 2016 в 12:39

Little Fox's user avatar

Little FoxLittle Fox

5944 серебряных знака18 бронзовых знаков

2

Если у тебя консольное приложение, надо определить main, а если оконное приложение Windows, то WinMain.

ответ дан 23 фев 2012 в 7:42

devoln's user avatar

devolndevoln

5,38120 серебряных знаков31 бронзовый знак

Permalink

Cannot retrieve contributors at this time

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Linker Tools Error LNK1561

Linker Tools Error LNK1561

11/04/2016

LNK1561

LNK1561

cb0b709b-7c9c-4496-8a4e-9e1e4aefe447

entry point must be defined

The linker did not find an entry point, the initial function to call in your executable. By default, the linker looks for a main or wmain function for a console app, a WinMain or wWinMain function for a Windows app, or DllMain for a DLL that requires initialization. You can specify another function by using the /ENTRY linker option.

This error can have several causes:

  • You may not have included the file that defines your entry point in the list of files to link. Verify that the file that contains the entry point function is linked into your app.
  • You may have defined the entry point using the wrong function signature; for example, you may have misspelled or used the wrong case for the function name, or specified the return type or parameter types incorrectly.
  • You may not have specified the /DLL option when building a DLL.
  • You may have specified the name of the entry point function incorrectly when you used the /ENTRY linker option.
  • If you are using the LIB tool to build a DLL, you may have specified a .def file. If so, remove the .def file from the build.

When building an app, the linker looks for an entry point function to call to start your code. This is the function that is called after the app is loaded and the runtime is initialized. You must supply an entry point function for an app, or your app can’t run. An entry point is optional for a DLL. By default, the linker looks for an entry point function that has one of several specific names and signatures, such as int main(int, char**). You can specify another function name as the entry point by using the /ENTRY linker option.

Example

The following sample generates LNK1561:

// LNK1561.cpp
// LNK1561 expected
int i;
// add a main function to resolve this error

Permalink

Cannot retrieve contributors at this time

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Linker Tools Error LNK1561

Linker Tools Error LNK1561

11/04/2016

LNK1561

LNK1561

cb0b709b-7c9c-4496-8a4e-9e1e4aefe447

entry point must be defined

The linker did not find an entry point, the initial function to call in your executable. By default, the linker looks for a main or wmain function for a console app, a WinMain or wWinMain function for a Windows app, or DllMain for a DLL that requires initialization. You can specify another function by using the /ENTRY linker option.

This error can have several causes:

  • You may not have included the file that defines your entry point in the list of files to link. Verify that the file that contains the entry point function is linked into your app.
  • You may have defined the entry point using the wrong function signature; for example, you may have misspelled or used the wrong case for the function name, or specified the return type or parameter types incorrectly.
  • You may not have specified the /DLL option when building a DLL.
  • You may have specified the name of the entry point function incorrectly when you used the /ENTRY linker option.
  • If you are using the LIB tool to build a DLL, you may have specified a .def file. If so, remove the .def file from the build.

When building an app, the linker looks for an entry point function to call to start your code. This is the function that is called after the app is loaded and the runtime is initialized. You must supply an entry point function for an app, or your app can’t run. An entry point is optional for a DLL. By default, the linker looks for an entry point function that has one of several specific names and signatures, such as int main(int, char**). You can specify another function name as the entry point by using the /ENTRY linker option.

Example

The following sample generates LNK1561:

// LNK1561.cpp
// LNK1561 expected
int i;
// add a main function to resolve this error

I try to compile a very simple dynamic library project as .dll file.
The name of the project is «Library».
I’m using Visual Studio 2015 and the project properties are these:

Debug Properties

Release Properties

In the project there are two files only: ClassA.h and ClassA.cpp.

The code in ClassA.h is:

#ifndef CLASSA_H
#define CLASSA_H

using namespace std;

#ifdef LIBRARY_EXPORTS
#define CLASSA_API __declspec(dllexport) 
#else
#define CLASSA_API __declspec(dllimport) 
#endif

class ClassA
{
public:
    static CLASSA_API void func();
};


#endif

The code in ClassA.cpp is:

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


void ClassA::func()
{
    cout << "SUCCESS!" << endl;
}

When I try to compile this project I receive this error:

Severity Code Description Project File Line Error LNK1561 entry point
must be defined Library C:UsersUX303DocumentsVisual Studio
2015DLLTestLibraryLINK 1

asked May 30, 2016 at 15:22

Radioga's user avatar

RadiogaRadioga

4161 gold badge5 silver badges16 bronze badges

3

It is likely that your configuration is not right.

Be sure to double check your «Active Configuration» (Debug / Release), to see if you are really building a DLL.

I have just made such a mistake, and came across this question.

answered Jun 1, 2017 at 12:13

sanbrother's user avatar

sanbrothersanbrother

2343 silver badges5 bronze badges

1

In 64 bit machine I was getting same error when ‘Solution Platforms’ set to ‘x86’. The error goes away when I set the ‘Solution Platforms’ to ‘x64’.

answered Nov 25, 2018 at 13:18

Pabitra Dash's user avatar

Pabitra DashPabitra Dash

1,4152 gold badges21 silver badges28 bronze badges

1

I try to compile a very simple dynamic library project as .dll file.
The name of the project is «Library».
I’m using Visual Studio 2015 and the project properties are these:

Debug Properties

Release Properties

In the project there are two files only: ClassA.h and ClassA.cpp.

The code in ClassA.h is:

#ifndef CLASSA_H
#define CLASSA_H

using namespace std;

#ifdef LIBRARY_EXPORTS
#define CLASSA_API __declspec(dllexport) 
#else
#define CLASSA_API __declspec(dllimport) 
#endif

class ClassA
{
public:
    static CLASSA_API void func();
};


#endif

The code in ClassA.cpp is:

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


void ClassA::func()
{
    cout << "SUCCESS!" << endl;
}

When I try to compile this project I receive this error:

Severity Code Description Project File Line Error LNK1561 entry point
must be defined Library C:UsersUX303DocumentsVisual Studio
2015DLLTestLibraryLINK 1

asked May 30, 2016 at 15:22

Radioga's user avatar

RadiogaRadioga

4161 gold badge5 silver badges16 bronze badges

3

It is likely that your configuration is not right.

Be sure to double check your «Active Configuration» (Debug / Release), to see if you are really building a DLL.

I have just made such a mistake, and came across this question.

answered Jun 1, 2017 at 12:13

sanbrother's user avatar

sanbrothersanbrother

2343 silver badges5 bronze badges

1

In 64 bit machine I was getting same error when ‘Solution Platforms’ set to ‘x86’. The error goes away when I set the ‘Solution Platforms’ to ‘x64’.

answered Nov 25, 2018 at 13:18

Pabitra Dash's user avatar

Pabitra DashPabitra Dash

1,4152 gold badges21 silver badges28 bronze badges

1

Понравилась статья? Поделить с друзьями:
  • Ошибка тофика бахрамова
  • Ошибка терминала 4134 сбербанк как исправить
  • Ошибка тойота рав 4 p2118
  • Ошибка торрента указано несуществующее устройство
  • Ошибка терминала 4128 как исправить