-
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
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
lalalalalalala 0 / 0 / 0 Регистрация: 19.05.2013 Сообщений: 15 |
||||||||
1 |
||||||||
25.01.2018, 18:54. Показов 8817. Ответов 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 |
Администратор 15251 / 12289 / 4905 Регистрация: 17.03.2014 Сообщений: 24,888 Записей в блоге: 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 |
Администратор 15251 / 12289 / 4905 Регистрация: 17.03.2014 Сообщений: 24,888 Записей в блоге: 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 |
How do I correct this Linker error building a mex function? LINK : fatal error LNK1561: entry point must be defined
I’m trying to build a NVIDIA CUDAC++ function supplied to me from a colleague. The linker gives me this error:
>> mex -L»C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.0libx64″ -lcudart -lcuda -llibmex LINKFLAGS=»/NODEFAULTLIB:LIBCMT» GpuInterp.cc scandata.c gpulink.o Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved.
C:UsersTonyAppDataLocalTempmex_vQULwRGpuInterp.obj C:UsersTonyAppDataLocalTempmex_vQULwRscandata.obj gpulink.o LINK : fatal error LNK1561: entry point must be defined
C:PROGRA~1MATLABR2011BBINMEX.PL: Error: Link of ‘GpuInterp.mexw64’ failed.
Error using mex (line 206) Unable to complete successfully.
———————————————— Here are my Compiler and Linker configurations: ————————————————
>> cc = mex.getCompilerConfigurations()
cc =
mex.CompilerConfiguration
Package: mex
Properties:
Name: ‘Microsoft Visual C++ 2008’
Manufacturer: ‘Microsoft’
Language: ‘C++’
Version: ‘9.0’
Location: ‘C:Program Files (x86)Microsoft Visual Studio 9.0’
Details: [1×1 mex.CompilerConfigurationDetails]
Methods
>> cc.Details
ans =
mex.CompilerConfigurationDetails
Package: mex
Properties:
CompilerExecutable: ‘cl’
CompilerFlags: [1×115 char]
OptimizationFlags: ‘/O2 /Oy- /DNDEBUG’
DebugFlags: ‘/Z7’
LinkerExecutable: ‘link’
LinkerFlags: [1×317 char]
LinkerOptimizationFlags: »
LinkerDebugFlags: ‘/DEBUG /PDB:»%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb»‘
Methods
>> cc.Details.CompilerFlags
ans =
/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
>> cc.Details.LinkerFlags
ans =
/dll /export:%ENTRYPOINT% /LIBPATH:»%LIBLOC%» libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:»%LIB_NAME%.x» /MAP:»%OUTDIR%%MEX_NAME%%MEX_EXT%.map»
>>
Accepted Answer
Do you have the required mexFunction entry point defined in one of your source files?
More Answers (1)
Yes I do, in the first compiled file GpuInterp.cc
hi,
on windows 8, when i try to build xgboost solution (comprising xgboost and xgboost_wrapper projects) on microsoft visual studio 2010 professional (with omp), the following error is generated (see below for full log):
2>LINK : fatal error LNK1561: entry point must be defined
when i then try to debug using f5, the following errors are generated:
‘xgboost.exe’: Loaded ‘C:UsersChongDownloadsxgboost-masterxgboost-masterwindowsReleasexgboost.exe’, Symbols loaded.
‘xgboost.exe’: Loaded ‘C:WindowsSysWOW64ntdll.dll’, Cannot find or open the PDB file
‘xgboost.exe’: Loaded ‘C:WindowsSysWOW64kernel32.dll’, Cannot find or open the PDB file
‘xgboost.exe’: Loaded ‘C:WindowsSysWOW64KernelBase.dll’, Cannot find or open the PDB file
<… A
The program ‘[5512] xgboost.exe: Native’ has exited with code 0 (0x0).
any idea what went wrong?
—— Build started: Project: xgboost, Configuration: Release Win32 ——
2>—— Build started: Project: xgboost_wrapper, Configuration: Release Win32 ——
1>Build started 5/9/2014 4:19:40 PM.
2>Build started 5/9/2014 4:19:40 PM.
1>InitializeBuildStatus:
1> Creating «Releasexgboost.unsuccessfulbuild» because «AlwaysCreate» was specified.
2>InitializeBuildStatus:
2> Touching «Releasexgboost_wrapper.unsuccessfulbuild».
1>ClCompile:
1> gbm.cpp
2>ClCompile:
2> gbm.cpp
2> io.cpp
1> io.cpp
2> updater.cpp
1> updater.cpp
1> xgboost_main.cpp
2> xgboost_wrapper.cpp
1>Link:
1> Creating library C:UsersChongDownloadsxgboost-masterxgboost-masterwindowsReleasexgboost.lib and object C:UsersChongDownloadsxgboost-masterxgboost-masterwindowsReleasexgboost.exp
1> Generating code
2>Link:
2> Creating library C:UsersChongDownloadsxgboost-masterxgboost-masterwindowsReleasexgboost_wrapper.lib and object C:UsersChongDownloadsxgboost-masterxgboost-masterwindowsReleasexgboost_wrapper.exp
2>LINK : fatal error LNK1561: entry point must be defined
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:02.81
1> Finished generating code
1> xgboost.vcxproj -> C:UsersChongDownloadsxgboost-masterxgboost-masterwindowsReleasexgboost.exe
1>FinalizeBuildStatus:
1> Deleting file «Releasexgboost.unsuccessfulbuild».
1> Touching «Releasexgboost.lastbuildstate».
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:06.06
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
-
08-09-2006
#1
Registered User
LINK : fatal error LNK1561: entry point must be defined
I’m trying to compile some code from a book, I have set all the correct linker and compiler options for SDL libs and headers. But I get this error:
LINK : fatal error LNK1561: entry point must be definedThis is my code:
Code:
#include <SDL.h> int main (int argc, char* argv[]) { if (SDL_Init( SDL_INIT_VIDEO ) < 0) return -1; SDL_WM_SetCaption("Hello World", "Hello World"); SDL_Surface* screen = SDL_SetVideoMode(640,480, 0, 0); SDL_Surface* temp = SDL_LoadBMP("data\textures\sdl_logo.bmp"); SDL_Surface* bg = SDL_DisplayFormat(temp); SDL_FreeSurface(temp); SDL_Event event; bool quit = false; while (!quit) { if (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: quit = true; break; case SDL_KEYDOWN: switch (event.key.keysym.sym) { case SDLK_ESCAPE: quit = true; break; } break; } } SDL_BlitSurface(bg, NULL, screen, NULL); SDL_UpdateRect(screen, 0, 0, 0, 0); } SDL_FreeSurface (bg); SDL_Quit(); return 0; }
-
08-09-2006
#2
pronounced ‘fib’
That’s odd. I wonder if something in the SDL header isn’t screwing with the main() definition.
«You are stupid! You are stupid! Oh, and don’t forget, you are STUPID!» — Dexter
-
08-09-2006
#3
pronounced ‘fib’
what type of project did you set it up as? Did you try a console application?
«You are stupid! You are stupid! Oh, and don’t forget, you are STUPID!» — Dexter
-
08-09-2006
#4
Registered User
Tried a console application. I’m using MSVC++ 2005 Express, I tried both Win32 Console App and CLR Console App, but neither worked.
Any other ideas?
-Ben
-
08-09-2006
#5
erstwhile
msvc 2005 defines UNICODE by default and therefore implicitly uses the wide character variants of main and WinMain (wmain and wWinMain) as entry points. Try disabling unicode and rebuilding.
project menu —> project options —> configuration properties —> General, change character set to ‘not set’.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
-
08-09-2006
#6
Registered User
What happens if you comment everything except
Code:
int main (int argc, char* argv[]) { return 0; }
What is the value of Entry Point and No Entry Point fields in Project Properties —> Linker —> Advanced panel?
-
08-09-2006
#7
Registered User
Thanks, but it didn’t work, it was already set to «Not set», I tried it on Unicode and Multi-Byte, but neither worked.
-Ben
-
08-09-2006
#8
Registered User
It’s stopped giving me that previous error, and now gives this:
—— Build started: Project: SDLHelloWorld, Configuration: Debug Win32 ——
Compiling…
main.cpp
Linking…
LINK : error LNK2001: unresolved external symbol _main
main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_UpdateRect referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_UpperBlit referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_PollEvent referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_FreeSurface referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_DisplayFormat referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_LoadBMP_RW referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_WM_SetCaption referenced in function _SDL_main
main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
C:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldDebugSDLHelloWorld.ex e : fatal error LNK1120: 12 unresolved externals
Build log was saved at «file://c:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldSDLHelloWorldDebugBu ildLog.htm»
SDLHelloWorld — 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========Viorel: I tried that, and it gave the error LINK : error LNK2001: unresolved external symbol _main
The value of entry point was blank, but i changed it to «main», and No Entry Point is No
-Ben
-
08-09-2006
#9
Registered User
Ok, seems that I hadn’t linked SDL.lib and SDLmain.lib properly. Now I get this:
—— Build started: Project: SDLHelloWorld, Configuration: Debug Win32 ——
Linking…
LINK : fatal error LNK1104: cannot open file ‘uuid.lib’
Build log was saved at «file://c:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldSDLHelloWorldDebugBu ildLog.htm»
SDLHelloWorld — 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========I tried setting Ignore Specific Library to «uuid.lib», but that gave this:
—— Build started: Project: SDLHelloWorld, Configuration: Debug Win32 ——
Linking…
MSVCRT.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
LINK : warning LNK4098: defaultlib ‘MSVCRT’ conflicts with use of other libs; use /NODEFAULTLIB:library
C:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldDebugSDLHelloWorld.ex e : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at «file://c:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldSDLHelloWorldDebugBu ildLog.htm»
SDLHelloWorld — 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========Any ideas?
-Ben
-
08-09-2006
#10
(?<!re)tired
Well, certainly you wouldn’t expect it to work if you set your linker to ignore a library it is asking for…
LINK : fatal error LNK1104: cannot open file ‘uuid.lib’
Do you have have the Platform SDK installed?
Last edited by Mario F.; 08-09-2006 at 06:17 AM.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
-
08-09-2006
#11
Registered User
Ok, got rid of the ignore, added the platform sdk path to the library and include lists, now i get this:
—— Build started: Project: SDLHelloWorld, Configuration: Debug Win32 ——
Linking…
MSVCRT.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
LINK : warning LNK4098: defaultlib ‘MSVCRT’ conflicts with use of other libs; use /NODEFAULTLIB:library
C:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldDebugSDLHelloWorld.ex e : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at «file://c:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldSDLHelloWorldDebugBu ildLog.htm»
SDLHelloWorld — 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========-Ben
-
08-09-2006
#12
Registered User
There you go.
Originally Posted by om3ga
Ok, got rid of the ignore, added the platform sdk path to the library and include lists, now i get this:
—— Build started: Project: SDLHelloWorld, Configuration: Debug Win32 ——
Linking…
MSVCRT.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
LINK : warning LNK4098: defaultlib ‘MSVCRT’ conflicts with use of other libs; use /NODEFAULTLIB:library
C:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldDebugSDLHelloWorld.ex e : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at «file://c:Documents and SettingsEVALMy DocumentsVisual Studio 2005ProjectsSDLHelloWorldSDLHelloWorldDebugBu ildLog.htm»
SDLHelloWorld — 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========-Ben
-
08-09-2006
#13
Cat without Hat
No, that’s a poor solution.
The problem here is that the SDL libs were compiled using a different runtime library setting than your program. Experiment with the runtime library setting in the general options. My best guess is to use multi-threaded static non-debug.
All the buzzt!
CornedBee
«There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.»
— Flon’s Law
-
08-09-2006
#14
Registered User
Ok, Multi-threaded DLL works. It gave me an error then about SDL.dll, so I moved SDL.dll to the debug folder inside my project folder, now I get a console window, then this error in a message box with the options «break» and «continue»:
Unhandled exception at 0x00401139 in SDLHelloWorld.exe: 0xC0000005: Access violation reading location 0x08c6f99c.-Ben
-
08-09-2006
#15
Cat without Hat
Well, choose break and look at what the debugger tells you.
All the buzzt!
CornedBee
«There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.»
— Flon’s Law