Что означает эта ошибка?
1> LINK : не найден или не выполнена сборка c:userscsdocumentsvisual studio 2010ProjectsролролглDebugVwe.exe при последней инкрементной компоновке; выполняется полная компоновка
1>LINK : fatal error LNK1561: точка входа должна быть определена
![]()
задан 22 фев 2012 в 17:29
Возможно вы создали пустой проект, пользуясь мастером Visual Studio, и пытаетесь его скомпилировать и слинковать. А так как он не имеет метода main (для консольного приложения) и т.п., то сборщик и сообщает об ошибке.
Либо используйте другой шаблон проекта, либо добавьте в проект файл содержащий точку входа.
ответ дан 22 фев 2012 в 17:46
stanislavstanislav
34.1k25 золотых знаков95 серебряных знаков212 бронзовых знаков
Правая кнопка мыши на Проект -> Свойства -> Компоновщик -> Все параметры -> Подсистема.
Выберите — «Консоль».
Также не забудьте о main();
![]()
Denis
8,84010 золотых знаков28 серебряных знаков54 бронзовых знака
ответ дан 12 мая 2016 в 12:39
![]()
Little FoxLittle Fox
5944 серебряных знака18 бронзовых знаков
2
Если у тебя консольное приложение, надо определить main, а если оконное приложение Windows, то WinMain.
ответ дан 23 фев 2012 в 7:42
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
|
lalalalalalala 0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
||||||||
|
1 |
||||||||
|
25.01.2018, 18:54. Показов 8712. Ответов 13 Метки c, clr, visual studio 2015, visual studio (Все метки)
Доброго времени суток! Пытаюсь разобраться с созданием оконного приложения на с++ в VS 2015. действительно не знаю, что делать). Project.cpp
MyForm1.h
__________________
0 |
|
lArtl 322 / 174 / 78 Регистрация: 09.10.2014 Сообщений: 809 |
||||
|
25.01.2018, 20:59 |
2 |
|||
Затем перейти в свойства проекта ->Компоновщик(Linker)->Дополнительно->Точка входа = Main
0 |
|
0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
|
|
26.01.2018, 15:50 [ТС] |
3 |
|
замена void main на Void Main не помогла
0 |
|
Администратор
15227 / 12266 / 4902 Регистрация: 17.03.2014 Сообщений: 24,867 Записей в блоге: 1 |
|
|
26.01.2018, 15:54 |
4 |
|
lalalalalalala, вторую часть совета ты выполнила?
Затем перейти в свойства проекта ->Компоновщик(Linker)->Дополнительно->Точка входа = Main
0 |
|
0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
|
|
26.01.2018, 15:59 [ТС] |
5 |
|
Конечно
0 |
|
322 / 174 / 78 Регистрация: 09.10.2014 Сообщений: 809 |
|
|
26.01.2018, 17:59 |
6 |
|
Конечно Уверены? Для Debug и Release?
0 |
|
0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
|
|
26.01.2018, 19:12 [ТС] |
7 |
|
Да.
0 |
|
322 / 174 / 78 Регистрация: 09.10.2014 Сообщений: 809 |
|
|
26.01.2018, 20:52 |
8 |
|
Да. Только ошибка изменилась, да? Свойства проекта ->Компоновщик(Linker)->Система->Подсистема = Windows
0 |
|
0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
|
|
27.01.2018, 19:48 [ТС] |
9 |
|
Вы удивитесь, но нет. Ошибка осталась прежней. Свойство Подсистема и было с самого начала Windows (и для Debug, и для Release).
0 |
|
Администратор
15227 / 12266 / 4902 Регистрация: 17.03.2014 Сообщений: 24,867 Записей в блоге: 1 |
|
|
27.01.2018, 20:03 |
10 |
|
lalalalalalala, проект целиком можешь выложить?
0 |
|
322 / 174 / 78 Регистрация: 09.10.2014 Сообщений: 809 |
|
|
27.01.2018, 22:47 |
11 |
|
Вы удивитесь, но нет. Ошибка осталась прежней. Свойство Подсистема и было с самого начала Windows (и для Debug, и для Release). Если ошибка таже, то вы не сделали то, о чем я вам писал из первого поста. МБ вы изменили для x64 платформы и компилируете под x32? Проверьте. Добавлено через 41 секунду
0 |
|
0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
|
|
28.01.2018, 11:18 [ТС] |
12 |
|
МБ вы изменили для x64 платформы и компилируете под x32? Проверьте. Проверила.
0 |
|
322 / 174 / 78 Регистрация: 09.10.2014 Сообщений: 809 |
|
|
28.01.2018, 13:14 |
13 |
|
Вот проект, может так найдется, где и что я делаю не так. Debug x86 вы все сделали правильно. Теперь сделайте тоже самое для Release x86 и все будет хорошо.
0 |
|
0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
|
|
11.02.2018, 01:05 [ТС] |
14 |
|
У Вас всё скомпилировалось? Добавлено через 14 минут Добавлено через 5 секунд
0 |
LINK: фатальная ошибка LNK1561: точка входа должна быть определена ERROR IN VС++
29 SortOf [2013-06-12 19:12:00]
Я впервые установил MS VS VC++, чтобы начать программировать OpenGL с библиотекой GLFW. Я следую инструкциям по его установке на http://shawndeprey.blogspot.com/2012/02/setting-up-glfw-in-visual-studio-2010.html Затем я написал эту простую программу, просто чтобы протестировать ее, который работал на Eclipse:
Но потом я получил эту ужасную ошибку:
Я знаю, что я искал в Интернете, и единственное решение, которое я нашел, было «Для работы требуется функция main() «. У меня, очевидно, есть это, прямо там, но это все еще бросает мне ту же самую фатальную ошибку 🙁
Было бы здорово получить ответ о том, как это исправить. Может быть, у меня есть недостатки в процессе установки или что-то в этом роде.
c++ visual-c++ visual-studio
10 ответов
Это проект консоли или проект Windows? Я спрашиваю, потому что для Win32 и аналогичного проекта точка входа WinMain() .
- Щелкните правой кнопкой мыши проект (а не решение) с левой стороны.
- Затем нажмите «Свойства» → «Свойства конфигурации» → «Линкер» → «Система»
Если он говорит Subsystem Windows , ваша точка входа должна быть WinMain(), т.е.
Кроме того, говоря о комментариях. Это компиляция (или, точнее, ссылка), а не ошибка времени выполнения. Когда вы начинаете отлаживать, компилятор должен сделать полную программу (а не только для компиляции вашего модуля), и именно тогда возникает ошибка.
Он даже не доходит до того, что загружается и выполняется.
8 ash [2013-06-12 19:44:00]
Невозможно найти точку входа для вашей программы, в данном случае main() . Вероятно, ваши настройки компоновщика неверны.
В моем случае программа работала нормально, а потом, через день, я просто столкнулся с этой проблемой, ничего не делая.
Решение, которое сработало (до редактирования область была пуста):

измените его на Консоль (/SUBSYSTEM: CONSOLE), она будет работать
Вы можете получить эту ошибку, если вы определяете проект как .exe, но хотите создать .lib или .dll
0 sdff [2015-10-29 04:15:00]
У меня это произошло на VS после того, как я изменил окончание строки файла. Изменение их обратно в Windows CR LF исправило проблему.
0 lizard [2018-07-31 20:44:00]
Главное отсутствовало в конфигурации точки входа. 
0 Brackets [2016-12-30 20:51:00]
В Visual Studio: Свойства -> Расширенные -> Точка входа -> записать только имя функции, с которой программа должна начинаться, с учетом регистра, без каких-либо скобок и аргументов командной строки.
0 dude [2017-10-09 18:51:00]
Если у кого-то возникли проблемы с этим, я сам получил один пустой .cpp файл в другом проекте даже (но в том же решении) и просто дал ему простой main с возвратом 0; и затем работал хорошо.
Я только что узнал, что в моем коде функция int main() не была включена, и это было: int choice() и еще одна, называемая int choice() внутри первой. Тогда проблем может быть 2: вы должны включить функцию int main(), или вы не можете иметь две переменные/функции или объявления (int, string, char, double, float, double float. ) в одной и той же функции, Я хочу сказать, что я просто думаю, потому что я просто пишу для развлечения и никогда не учился c++.
Я работаю с Visual Studio 2012.
У моего решения есть 3 проекта
Projecta
projectB
projectC
и Иерархия как
projectC зависит от projectB которые в свою очередь зависят от Projecta. Eсть основная функция в projectC и нет основного в projectB и projectA.
Ошибки, которые я получаю:
error LNK1561: entry point must be defined projectA
error LNK1561: entry point must be defined projectB
Я пытался изменить в
Свойства конфигурации -> Линкер -> Система -> Подсистема в консоль (/ SUBSYSTEM: CONSOLE) Но проблема все еще сохраняется
Помоги мне в этом.
11
Решение
Кажется, вы неправильно поняли термин «модуль». В Visual Studio такого проекта C ++ нет; Проекты C ++ можно разделить на три категории:
- Программы — компиляция производит
exeфайл, который может быть выполнен; - Статические библиотеки — компиляция производит
libфайл, который может быть включен в другой проект и связан во время компиляции; - Динамические библиотеки — компиляция производит
dllфайл, который может быть прикреплен к вашей программе во время выполнения и обеспечивает дополнительную функциональность.
Из вашего описания вы хотите, чтобы projectB и projectC были статическими библиотеками, но вместо этого вы создали их как исполняемые файлы. Снова запустите мастер создания нового проекта и выберите «статическая библиотека» вместо «Приложение Windows».
Вы можете прочитать больше о статических библиотеках в Библиотека MSDN.
Если статические библиотеки слишком тяжелые для вашего приложения, вы можете просто включить файлы projectB и projectC в свой проект (опционально позаботьтесь о пространствах имен, чтобы не перепутать имена классов). Все зависит от того, какую функциональность вы планируете реализовать в этих «модулях».
18
Другие решения
установите Свойства -> Компоновщик -> Система -> Подсистема на «Windows (/ SUBSYSTEM: WINDOWS)»
9
Я предполагаю, что вы используете Windows для создания этого проекта, для меня, если я обычно использую SDL, я получаю эту ошибку, все, что вам нужно сделать, это ввести #include <Windows.h> это должно исправить это, если нет, то я не уверен, как это исправить.
0
If you a developer using Visual Studio for writing code, then you may encounter the below error at some point of time.
LINK : fatal error LNK1561: entry point must be defined
The error is self-explanatory but you must know how to fix it. If you are facing this fatal error LNK1561 error, you are at the right place. I will share the steps you can follow to resolve this Visual Studio error. Typically the error can appear on any version of Visual Studio and the below steps are applicable on all versions of Visual Studio IDE.
Reason:
The error LINK : fatal error LNK1561: entry point must be defined” appears when you are trying to build the code. The VS linker does not find the entry point function in your code; so it can not call your code.
There can be multiple scenarios when you can get this error. In this article, I will share 3 common checks that you can verify in your project configuration to make sure the error does not appear.
Fix #1:
In the first troubleshooting step, you need to know the intent of your code. If you have written the code to build a .dll or .lib; and your project settings is configured as .exe, then you will get this error.
You need to change the “Configuration type” from exe to dll or lib.
- Right-click on the project (not on the solution) and go to properties.
- Under General section, look for the “Configuration type” field.
- Change the type from Application (.exe) to Dynamic Library (.dll) or Static Library (.lib) based on your code.
- Click on OK to save the changes.
- Clean the project and build it again.

Fix #2:
If the intent of your code is to build an exe, then the Fix #1 does not hold good. If you are creating a console application, the linker looks for main function and for Windows application, it expects WinMain function to be present as entry point to your code.
- Go to project properties by right clicking on the project and selecting properties from the list.
- Under Linker → Advanced section, check the “Entry Point” field.
- If the field is empty and you have main/WinMain present as the entry point, the issue should not appear.
- In case, you face the same error, you can manually update the Entry Point to main/WinMain based on your project type.
Fix #3:
If you have a different entry point function other than main or WinMain, you need to update the function name in the “Entry Point” field.
- Right-click on the project and go to properties.
- Under Linker → Advanced section, update the “Entry Point” field to your function name.

Final words:
That’s it. These are the only possible steps to fix “fatal error LNK1561: entry point must be defined” error in Visual Studio. I hope your issue is not resolved. Do share your comments below and any tips and tricks you followed to help other developers.
Cheers !!!
Other Visual Studio errors:
1. fatal error LNK1221: a subsystem can’t be inferred and must be defined
2. mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file
-
Question
-
I am trying to make an executable from source code, headers, etc.
I am using Visual Studio 10.0.
I get this message.
Can someone help me?
Thanks.
LINK : fatal error LNK1561: entry point must be defined
All replies
-
Raleigh77 wrote:
I am trying to make an executable from source code, headers, etc.
LINK : fatal error LNK1561: entry point must be defined
You haven’t defined a function named main or wmain or WinMain or wWinMain.
Igor Tandetnik
-
If please possible quote the program or just the part of program which consist your entry point of your program. i.e. the part of program having the Main() fuction is it is a console program, the cmd type. or WinMain() function
if a windows program. If there isn’t one such function then thats is your problem. Your program must have a entry point fuction in other words the function from which your program starts. There might be a possibilty you might have misstyped the fuction name
incorrectly.-
Proposed as answer by
Tuesday, November 22, 2011 4:39 AM
-
Proposed as answer by
-
>There might be a possibilty you might have misstyped
>the fuction name incorrectly.<evil grin> As you did when you typed:
>…the part of program which consist your entry point
>of your program. i.e. the part of program having the
>Main() fuction is it is a console program …It should be: «main() function …»
C and C++ are case-sensitive languages. The names
«main» and «Main» are not the same.— Wayne
-
Proposed as answer by
detectivecalcite
Thursday, October 4, 2012 6:14 AM
-
Proposed as answer by
-
Thanks.
This came from here.
http://msdn.microsoft.com/en-us/library/aa363680%28v=vs.85%29.aspx
Andy
// report_event
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <stdio.h>
#include «provider.h»#pragma comment(lib, «advapi32.lib»)
#define PROVIDER_NAME L»MyEventProvider»
// Hardcoded insert string for the event messages.
CONST LPWSTR pBadCommand = L»The command that was not valid»;
CONST LPWSTR pFilename = L»c:\folder\file.ext»;
CONST LPWSTR pNumberOfRetries = L»3″;
CONST LPWSTR pSuccessfulRetries = L»0″;
CONST LPWSTR pQuarts = L»8″;
CONST LPWSTR pGallons = L»2″;void wmain(void)
{
HANDLE hEventLog = NULL;
LPWSTR pInsertStrings[2] = {NULL, NULL};
DWORD dwEventDataSize = 0;// The source name (provider) must exist as a subkey of Application.
hEventLog = RegisterEventSource(NULL, PROVIDER_NAME);
if (NULL == hEventLog)
{
wprintf(L»RegisterEventSource failed with 0x%x.n», GetLastError());
goto cleanup;
}// This event includes user-defined data as part of the event. The event message
// does not use insert strings.
dwEventDataSize = ((DWORD)wcslen(pBadCommand) + 1) * sizeof(WCHAR);
if (!ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, UI_CATEGORY, MSG_INVALID_COMMAND, NULL, 0, dwEventDataSize, NULL, pBadCommand))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(), MSG_INVALID_COMMAND);
goto cleanup;
}// This event uses insert strings.
pInsertStrings[0] = pFilename;
if (!ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, DATABASE_CATEGORY, MSG_BAD_FILE_CONTENTS, NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(), MSG_BAD_FILE_CONTENTS);
goto cleanup;
}// This event uses insert strings.
pInsertStrings[0] = pNumberOfRetries;
pInsertStrings[1] = pSuccessfulRetries;
if (!ReportEvent(hEventLog, EVENTLOG_WARNING_TYPE, NETWORK_CATEGORY, MSG_RETRIES, NULL, 2, 0, (LPCWSTR*)pInsertStrings, NULL))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(), MSG_RETRIES);
goto cleanup;
}// This event uses insert strings.
pInsertStrings[0] = pQuarts;
pInsertStrings[1] = pGallons;
if (!ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, UI_CATEGORY, MSG_COMPUTE_CONVERSION, NULL, 2, 0, (LPCWSTR*)pInsertStrings, NULL))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(), MSG_COMPUTE_CONVERSION);
goto cleanup;
}wprintf(L»All events successfully reported.n»);
cleanup:
if (hEventLog)
DeregisterEventSource(hEventLog);
} -
I am using Visual Studio 10.0.
I get this message.
LINK : fatal error LNK1561: entry point must be defined
The code came from here.
http://msdn.microsoft.com/en-us/library/aa363680%28v=vs.85%29.aspx
Could someone help me with this problem?
Thanks.
// report_event
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <stdio.h>
#include «provider.h»#pragma comment(lib, «advapi32.lib»)
#define PROVIDER_NAME L»MyEventProvider»
// Hardcoded insert string for the event messages.
CONST LPWSTR pBadCommand = L»The command that was not valid»;
CONST LPWSTR pFilename = L»c:\folder\file.ext»;
CONST LPWSTR pNumberOfRetries = L»3″;
CONST LPWSTR pSuccessfulRetries = L»0″;
CONST LPWSTR pQuarts = L»8″;
CONST LPWSTR pGallons = L»2″;void wmain(void)
{
HANDLE hEventLog = NULL;
LPWSTR pInsertStrings[2] = {NULL, NULL};
DWORD dwEventDataSize = 0;// The source name (provider) must exist as a subkey of Application.
hEventLog = RegisterEventSource(NULL, PROVIDER_NAME);
if (NULL == hEventLog)
{
wprintf(L»RegisterEventSource failed with 0x%x.n», GetLastError());
goto cleanup;
}// This event includes user-defined data as part of the event. The event message
// does not use insert strings.
dwEventDataSize = ((DWORD)wcslen(pBadCommand) + 1) * sizeof(WCHAR);
if (!ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, UI_CATEGORY, MSG_INVALID_COMMAND, NULL, 0,dwEventDataSize, NULL, pBadCommand))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(),MSG_INVALID_COMMAND);
goto cleanup;
}// This event uses insert strings.
pInsertStrings[0] = pFilename;
if (!ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, DATABASE_CATEGORY, MSG_BAD_FILE_CONTENTS,NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(),MSG_BAD_FILE_CONTENTS);
goto cleanup;
}// This event uses insert strings.
pInsertStrings[0] = pNumberOfRetries;
pInsertStrings[1] = pSuccessfulRetries;
if (!ReportEvent(hEventLog, EVENTLOG_WARNING_TYPE, NETWORK_CATEGORY, MSG_RETRIES, NULL, 2, 0,(LPCWSTR*)pInsertStrings, NULL))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(), MSG_RETRIES);
goto cleanup;
}// This event uses insert strings.
pInsertStrings[0] = pQuarts;
pInsertStrings[1] = pGallons;
if (!ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, UI_CATEGORY, MSG_COMPUTE_CONVERSION,NULL, 2, 0, (LPCWSTR*)pInsertStrings, NULL))
{
wprintf(L»ReportEvent failed with 0x%x for event 0x%x.n», GetLastError(),MSG_COMPUTE_CONVERSION);
goto cleanup;
}wprintf(L»All events successfully reported.n»);
cleanup:
if (hEventLog)
DeregisterEventSource(hEventLog);
}-
Merged by
lucy-liu
Wednesday, February 9, 2011 3:11 AM
Merge them to keep in the same topic
-
Merged by
-
Configuration Properties, Linker, System, SubSystem => set to Console (/SUBSYSTEM:CONSOLE)
-
Configuration Properties, Linker, System, SubSystem => set to Console (/SUBSYSTEM:CONSOLE)
Duplicate post.
-
Thanks.
I uninstalled V.S. because of the difficulty of using it.
I used the Pro version, and it took about 6 hrs. to download and install.
I am rethinking if it would be worth the time and effort for what I would probably use
for only one C ++ source.
I currently use masm and it’s linker to produce 32 bit programs using assembly source code.
Andy
-
Hi Raleigh77,
Have you solved your issue?
If you have solved, please mark the useful reply as answer.
Best regards,
Lucy
Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
No help has worked. Does someone have some working code in C that uses ReportEvent? Thanks.
-
>Does someone have some working code in C that uses ReportEvent?
The code from the URL you posted compiles without errors or
warnings for me using VC++ 2008 Express.You need to supply more information about what you are
doing and how you are doing it, if you want detailed
help. You have made no mention of *exactly* how you
have tried to build this example. From the IDE?
From the command line? If IDE, using which Project
Template? If from the command line, what was the
actual and complete command used?— Wayne
-
I have the required dll file and header file for the project.
I used the 2003 PSDK to make those.
I believe in order to test if it works would require changing the path to that dll file.
I am willing to reinstall VC Express if I know that the program will actually work.
I could upload those files in order to assist in any way.
Could you do that for me?
Maybe a screen shot of the results?
Thanks,
Andy
-
I am at this point in my project.
Where is the Win32 App Wizard?
-
In the Win32 Application Wizard , click Application Settings to reveal options for Application type. Under
Additional Options , select Empty Project and then click
Finish . -
Further on down is this.
- Can I go straight to making the executable?
Can I stop the autoformatting for my replies?
Thanks.
-
To build and examine the program
-
On the Build menu, click Build Solution .
The Output window displays information about the compilation progress, for example, the location of the build log and a message that states the build status.
-
On the Debug menu, click Start without Debugging .
If you used the sample program, a command window is displayed and shows whether certain integers are found in the set.
-
-
-
Hello Raleigh77,
If you compiling from command line, just add /entry:wmain
Regards,
Andrew
-
Thanks Andrew.
I have used Visual C++ only about 10 times.
I will look at the help section for command line and see what is involved.
Andy
-
Clicked on Building on the Command Line and got:
-
Walkthrough: Compiling a Native C++ Program on the Command Line (C++)
-
Thanks, seeing some good progress.
Andy
report_event.cpp
C:Program FilesMicrosoft SDKsWindowsv6.0Aincludeprovider.h(25) : error C2470: ‘Provider’ : looks like a function definition, but there is no parameter list; skipping apparent body
report_event.cpp(38) : error C2065: ‘UI_CATEGORY’ : undeclared identifier
report_event.cpp(38) : error C2065: ‘MSG_INVALID_COMMAND’ : undeclared identifier
report_event.cpp(40) : error C2065: ‘MSG_INVALID_COMMAND’ : undeclared identifier
report_event.cpp(46) : error C2065: ‘DATABASE_CATEGORY’ : undeclared identifier
report_event.cpp(46) : error C2065: ‘MSG_BAD_FILE_CONTENTS’ : undeclared identifier
report_event.cpp(48) : error C2065: ‘MSG_BAD_FILE_CONTENTS’ : undeclared identifier
report_event.cpp(55) : error C2065: ‘NETWORK_CATEGORY’ : undeclared identifier
report_event.cpp(55) : error C2065: ‘MSG_RETRIES’ : undeclared identifier
report_event.cpp(57) : error C2065: ‘MSG_RETRIES’ : undeclared identifier
report_event.cpp(64) : error C2065: ‘UI_CATEGORY’ : undeclared identifier
report_event.cpp(64) : error C2065: ‘MSG_COMPUTE_CONVERSION’ : undeclared identifier
report_event.cpp(66) : error C2065: ‘MSG_COMPUTE_CONVERSION’ : undeclared identifier -
C:Program FilesMicrosoft SDKsWindowsv6.0Aincludeprovider.h(25) : error C2470: ‘Provider’ : looks like a function definition, but there is no parameter list; skipping apparent body
Are we supposed to guess what line 25 of provider.h contains?
— Wayne
-
// MyEventProvider.mc
// This is the header section.
// The following are the categories of events.
//
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +—+-+-+————————+——————————-+
// |Sev|C|R| Facility | Code
|
// +—+-+-+————————+——————————-+
//
// where
//
// Sev — is the severity code
//
// 00 — Success
// 01 — Informational
// 10 — Warning
// 11 — Error
//
// C — is the Customer code flag
//
// R — is a reserved bit
//
// Facility — is the facility code
//
// Code — is the facility’s status code
//
//
// Define the facility codes
//
#define FACILITY_SYSTEM 0x0
#define FACILITY_STUBS 0x3
#define FACILITY_RUNTIME 0x2
#define FACILITY_IO_ERROR_CODE 0x4//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING 0x2
#define STATUS_SEVERITY_SUCCESS 0x0
#define STATUS_SEVERITY_INFORMATIONAL 0x1
#define STATUS_SEVERITY_ERROR 0x3//
// MessageId: NETWORK_CATEGORY
//
// MessageText:
//
// Network Events
//
#define NETWORK_CATEGORY ((WORD)0x00000001L)//
// MessageId: DATABASE_CATEGORY
//
// MessageText:
//
// Database Events
//
#define DATABASE_CATEGORY ((WORD)0x00000002L)//
// MessageId: UI_CATEGORY
//
// MessageText:
//
// UI Events
//
#define UI_CATEGORY ((WORD)0x00000003L)// The following are the message definitions.
//
// MessageId: MSG_INVALID_COMMAND
//
// MessageText:
//
// The command is not valid.
//
#define MSG_INVALID_COMMAND ((DWORD)0xC0020100L)//
// MessageId: MSG_BAD_FILE_CONTENTS
//
// MessageText:
//
// File %1 contains content that is not valid.
//
#define MSG_BAD_FILE_CONTENTS ((DWORD)0xC0000101L)//
// MessageId: MSG_RETRIES
//
// MessageText:
//
// There have been %1 retries with %2 success! Disconnect from
// the server and try again later.
//
#define MSG_RETRIES ((DWORD)0x80000102L)//
// MessageId: MSG_COMPUTE_CONVERSION
//
// MessageText:
//
// %1 %%4096 = %2 %%4097.
//
#define MSG_COMPUTE_CONVERSION ((DWORD)0x40000103L)// The following are the parameter strings */
//
// MessageId: QUARTS_UNITS
//
// MessageText:
//
// quarts%0
//
#define QUARTS_UNITS ((DWORD)0x00001000L)//
// MessageId: GALLONS_UNITS
//
// MessageText:
//
// gallons%0
//
#define GALLONS_UNITS ((DWORD)0x00001001L) -
<sigh> Are we supposed to guess which line generated the error?
— Wayne
-
If you can’t help me without criticizing me, then I can do without your «Help.»
Andy
-
Raleigh77 wrote:
>
>Thanks, seeing some good progress.
>
>Andy
>
>report_event.cpp
>C:Program FilesMicrosoft SDKsWindowsv6.0Aincludeprovider.h(25) : error C2470: ‘Provider’ : looks like a function definition, but there is no parameter list; skipping apparent body
>report_event.cpp(38) : error C2065: ‘UI_CATEGORY’ : undeclared identifier
Are you including <windows.h> as your first include? The word before
«Provider» in provider.h is POLARITY, which is defined in <polarity.h>,
which should have been included, if you did things in the proper order.
—
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Tim Roberts, DDK MVP
-
Thanks Tim.
There is no reference to Polarity in any of my sources.
I am using everything at the website that was provided.
I will have to check but I believe that windows.h is in the source code.
I assume that VB C++ knows what to do and that it was included in the package
that I downloaded.
Andy
-
chocolatemint77581 wrote:
>
>There is no reference to Polarity in any of my sources.
Yes, I know that. There are thousands and thousands of standard API
include files, and those files depend greatly on one another, and on a
particular ordering. Somehow, you have caused a standard file to be
included without one of the files it depends on.
That can happen if you #include a specific file by name without including
<windows.h> first.
>I am using everything at the website that was provided.
>
>I will have to check but I believe that windows.h is in the source code.
>
>I assume that VB C++ knows what to do and that it was included in the package
>that I downloaded.
There are rules to be followed to use these APIs. It’s a little dangerous
to start compiling code without understanding what it does.
—
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Tim Roberts, DDK MVP
-
http://msdn.microsoft.com/en-us/library/aa363677%28v=vs.85%29.aspx
The source came from above, and as you can see, it is/was from Microsoft.
The following example shows how to use the
NotifyChangeEventLog function to receive notification when an event is logged.For the future, I will consider the possibility that any code, may be incomplete.
But I did learn a lot from the process. 🙂
Take care,
Andy
-
chocolatemint77581 wrote:
>
>
>The source came from above, and as you can see, it is/was from Microsoft.
>
>The following example shows how to use the NotifyChangeEventLog function to receive notification when an event is logged.
>
>For the future, I will consider the possibility that any code, may be incomplete.
I don’t see how you get that. I just cut-and-pasted that text into a file
called x.cpp, then did:
cl x.cpp
and it compiled and linked without any further ado.
Still, if you have achieved success, that’s what matters.
—
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Tim Roberts, DDK MVP
-
#define PROVIDER_NAME L"MyEventProvider"
#define RESOURCE_DLL L"<path>\Provider.dll"But did your .exe run correctly ?
If it did, you will have an event at the end of a specified event log.
( ReportEvent function writes an entry at the end of the specified event log.)
I have some other questions for you.
For the program to work, it needs a path to the dll.
Did you change <path> to the actual path?
Did you make provider.dll ?
And no, I did not achieve sucess.
Take care,
Andy
-
Hello people,
I have this problem in VS2010 10.0.30319.1 when i use template. if i put:
template <typename T>
int main(){
return 0;
}
i will get this LNK1561 error…
-
Edited by
Le10sn
Saturday, October 13, 2012 9:52 PM
-
Edited by
-
Le10sn wrote:
I have this problem in VS2010 10.0.30319.1 when i use template. if i put:
template <typename T>
int main(){
return 0;
}
i will get this LNK1561 error…
main() function cannot be a template. Think about it: main() is called by the operating system — how is the OS supposed to know which type to use for T?
Igor Tandetnik
-
Proposed as answer by
madhudskumar
Friday, July 18, 2014 4:38 AM -
Unproposed as answer by
madhudskumar
Friday, July 18, 2014 4:38 AM
-
Proposed as answer by
-
Remove the void from the parameters of the main()
it worked for me
