Connecting Tech Pros Worldwide Forums | Help | Site Map

VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120

Bil Muh
Guest
 
Posts: n/a
#1: Nov 22 '05
Hello Developers,
I use VC++ .NET v2003. By using Windows Forms .NET, I am developing an
application which will work with TCP/IP functions. I can Build my application
in Debug Mode normally, but, whenever I want to Build at Release Mode,
compiler gives LNK2001, LNK2019 ve LNK1120 errors. I read the MSDN documents,
unfortunately, I could not solve my problem. I am requesting your help.

All errors are below with my application name "TestFace_v2"

1)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
closesocket(unsigned int)" (?closesocket@@$$J14YGHI@Z)

2)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
connect(unsigned int,struct sockaddr const *,int)"
(?connect@@$$J212YGHIPBUsockaddr@@H@Z)

3)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
recv(unsigned int,char *,int,int)" (?recv@@$$J216YGHIPADHH@Z)

4)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
recv(unsigned int,char *,int,int)" (?recv@@$$J216YGHIPADHH@Z)

5)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
send(unsigned int,char const *,int,int)" (?send@@$$J216YGHIPBDHH@Z)

6)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
setsockopt(unsigned int,int,int,char const *,int)"
(?setsockopt@@$$J220YGHIHHPBDH@Z)

7)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
WSAGetLastError(void)" (?WSAGetLastError@@$$J10YGHXZ)

8)TestFace_v2 error LNK2001: unresolved external symbol "int __stdcall
WSAStartup(unsigned short,struct WSAData *)"
(?WSAStartup@@$$J18YGHGPAUWSAData@@@Z)

9)TestFace_v2 error LNK2001: unresolved external symbol "unsigned int
__stdcall socket(int,int,int)" (?socket@@$$J212YGIHHH@Z)

10)TestFace_v2 error LNK2001: unresolved external symbol "unsigned long
__stdcall inet_addr(char const *)" (?inet_addr@@$$J14YGKPBD@Z)

11)TestFace_v2 error LNK2001: unresolved external symbol "unsigned short
__stdcall htons(unsigned short)" (?htons@@$$J14YGGG@Z)

12)TestFace_v2 error LNK2019: unresolved external symbol "int __stdcall
WSAGetLastError(void)" (?WSAGetLastError@@$$J10YGHXZ) referenced in function
"public: __clrcall
TestFace_v2::frmConnectionSettings::frmConnectionS ettings(void)__gc "
(??0frmConnectionSettings@TestFace_v2@@$$FQ$AAM@XZ )

13)TestFace_v2 fatal error LNK1120: 10 unresolved externals




Oleg Starodumov
Guest
 
Posts: n/a
#2: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120



Is ws2_32.lib present in the list of import libraries in Release configuration?

(Project properties | Configuration Properties | Linker | Input | Additional Dependencies)

Regards,
Oleg




Bil Muh
Guest
 
Posts: n/a
#3: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


Hello,
Yes, "ws2_32.lib" is already in "Additional Dependencies" part where you
mentioned.

Best Regards,
Bil Muh


"Oleg Starodumov" wrote:
[color=blue]
>
> Is ws2_32.lib present in the list of import libraries in Release configuration?
>
> (Project properties | Configuration Properties | Linker | Input | Additional Dependencies)
>
> Regards,
> Oleg
>
>
>
>
>[/color]
Oleg Starodumov
Guest
 
Posts: n/a
#4: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


[color=blue]
> Yes, "ws2_32.lib" is already in "Additional Dependencies" part where you
> mentioned.
>[/color]

Add /verbose:lib to the list of linker options. Then when linking, the list
of libraries searched will be displayed in Output window.

Will ws2_32.lib be present in that list, and in the correct location,
when you build the release configuration?

Regards,
Oleg




Alper AKCAYOZ
Guest
 
Posts: n/a
#5: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


Can you kindly tell me exactly where to put /verbose::lib ? I am sorry, I
didnot understand it

"Oleg Starodumov" wrote:
[color=blue]
>[color=green]
> > Yes, "ws2_32.lib" is already in "Additional Dependencies" part where you
> > mentioned.
> >[/color]
>
> Add /verbose:lib to the list of linker options. Then when linking, the list
> of libraries searched will be displayed in Output window.
>
> Will ws2_32.lib be present in that list, and in the correct location,
> when you build the release configuration?
>
> Regards,
> Oleg
>
>
>
>
>[/color]
Oleg Starodumov
Guest
 
Posts: n/a
#6: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


[color=blue]
> Can you kindly tell me exactly where to put /verbose::lib ? I am sorry, I
> didnot understand it
>[/color]

Project properties | Configuration Properties | Linker | Command Line |
Additional Options.

Regards,
Oleg






Alper AKCAYOZ
Guest
 
Posts: n/a
#7: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


I have written /verbose::lib into that place before your answer.
Unfortunately, it still gives the LNK2001 error for all WinSock functions,
when I build in Release Mode.


"Oleg Starodumov" wrote:
[color=blue]
>[color=green]
> > Can you kindly tell me exactly where to put /verbose::lib ? I am sorry, I
> > didnot understand it
> >[/color]
>
> Project properties | Configuration Properties | Linker | Command Line |
> Additional Options.
>
> Regards,
> Oleg
>
>
>
>
>
>
>[/color]
Oleg Starodumov
Guest
 
Posts: n/a
#8: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


[color=blue]
> I have written /verbose::lib into that place before your answer.
> Unfortunately, it still gives the LNK2001 error for all WinSock functions,
> when I build in Release Mode.
>[/color]

/verbose option does not affect the outcome of linking, it only provides
some troubleshooting output in build output window.
Please look at that window and see whether the linker was able to find ws2_32.lib.
Also compare the output with debug build, to see if there are differences.

Regards,
Oleg




Alper AKCAYOZ
Guest
 
Posts: n/a
#9: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


I re-compile as you mentioned. Unfortunately, ws2_32.lib is not listed at
Release Build at the Output file. Also, I compare the Debug Output file and
Release output File. The only differenece is the lack of "ws2_32.lib" at
Release Build file.

Thank you in advance
Best Regards.
Alper
Oleg Starodumov
Guest
 
Posts: n/a
#10: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


[color=blue]
> I re-compile as you mentioned. Unfortunately, ws2_32.lib is not listed at
> Release Build at the Output file. Also, I compare the Debug Output file and
> Release output File. The only differenece is the lack of "ws2_32.lib" at
> Release Build file.
>[/color]

It means that ws2_32.lib is not specified in the list of import libraries.

Please check again Project Settings | Configuration Properties | Linker | Input |
Additional Dependencies, and make sure that ws2_32.lib is there.
Make sure that when you check it, Release is selected in Configuration listbox
at the top of the dialog page.

If it does not help, try to add ws2_32.lib to your project explicitly (in the same way
as you would add an ordinary source file).

Regards,
Oleg




Alper AKCAYOZ
Guest
 
Posts: n/a
#11: Nov 22 '05

re: VC++ .NET> Release Build results LNK2001, LNK2019 and LNK1120


I thank you very much. With your guidance, I solved the problem. The thing
that I did not noticed that is the "Configuration" combobox at the Project
Properties menu. When I was adding the "ws2_32.lib" to the Linker > Input >
Additional Dependencies, the "Configuration" combobox was setted to Debug.
Now, I added ws2_32.lib to all configurations.
I think that, when adding dependencies, it is better to add when the
"Configuration" combo-box is setted to "All Configurations"

"Oleg Starodumov" wrote:
[color=blue]
>[color=green]
> > I re-compile as you mentioned. Unfortunately, ws2_32.lib is not listed at
> > Release Build at the Output file. Also, I compare the Debug Output file and
> > Release output File. The only differenece is the lack of "ws2_32.lib" at
> > Release Build file.
> >[/color]
>
> It means that ws2_32.lib is not specified in the list of import libraries.
>
> Please check again Project Settings | Configuration Properties | Linker | Input |
> Additional Dependencies, and make sure that ws2_32.lib is there.
> Make sure that when you check it, Release is selected in Configuration listbox
> at the top of the dialog page.
>
> If it does not help, try to add ws2_32.lib to your project explicitly (in the same way
> as you would add an ordinary source file).
>
> Regards,
> Oleg
>
>
>
>
>[/color]
Closed Thread


Similar .NET Framework bytes