473,508 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error LNK2001: Nichtaufgelöstes externes Symbol; Please Help!

Hello people,

I have some problem with Debugging in MS Visual C++.
I want to generate a TCP/IP-Socket. The compiling-process is fine but
when I debugg the project there's occuring some errors like: 'error
LNK2001: Nichtaufgelöstes externes Symbol "unsigned int __stdcall
socket(int,int,int)" (?socket@@$$FYGIHHH@Z)"'

"Nichtaufgelöstes externes Symbol" means "unresolved external symbol"

Here is a smaller C++-file which creates the same error.

#define AF_INET 2 /* internetwork: TCP, etc. */
#define SOCK_STREAM 1 /* stream socket */

void main(){
unsigned int __stdcall socket(int af, int type, int protocol);
unsigned int iClient;
iClient = socket(AF_INET, SOCK_STREAM, 0);
}

I think there's some problem with the symbol "__stdcall", that Visual
C++ has a problem with C++- and C-code.

I have also tried
'"extern "C" { unsigned int __stdcall socket(int af, int type, int
protocol);
}'
but the same message occured.

Who can help?

Falk Fassmann
Jul 19 '05 #1
3 2817
Falk Fassmann wrote:
Hello people,

I have some problem with Debugging in MS Visual C++.
I want to generate a TCP/IP-Socket. The compiling-process is fine but
when I debugg the project there's occuring some errors like: 'error
LNK2001: Nichtaufgelöstes externes Symbol "unsigned int __stdcall
socket(int,int,int)" (?socket@@$$FYGIHHH@Z)"'

"Nichtaufgelöstes externes Symbol" means "unresolved external symbol"

Here is a smaller C++-file which creates the same error.

#define AF_INET 2 /* internetwork: TCP, etc. */
#define SOCK_STREAM 1 /* stream socket */

void main(){
In C++ main returns int.
unsigned int __stdcall socket(int af, int type, int protocol);
__stdcall is not standard C++. Please leave non-standard things out when
posting here. If the non-standard thing is the problem, then this is the
wrong place to ask.
unsigned int iClient;
iClient = socket(AF_INET, SOCK_STREAM, 0);
Well, I see no definition for the socket() function, so the linker error
is not particularly surprising. You can't use a function if it doesn't
have a definition. Supply a definition and the problem should go away.
}

I think there's some problem with the symbol "__stdcall", that Visual
C++ has a problem with C++- and C-code.


If that's the case then you should ask in a Visual C++ group.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #2
Thanks for your message, but this isn't solving my problems.

When I leave "__stdcall" out, it occures an other error:
error LNK2001: Nichtaufgelöstes externes Symbol "unsigned int __cdecl
socket(int,int,int)" (?socket@@$$FYAIHHH@Z)

The definition of:
"unsigned int iClient;
iClient = socket(AF_INET, SOCK_STREAM, 0);"

was: "unsigned int __stdcall socket(int af, int type, int protocol);"

now: "unsigned int socket(int af, int type, int protocol);"

It's the declaration of the function "socket" from winsock.h.
Falk

Kevin Goodsell <us*********************@neverbox.com> wrote in message news:<6E************@newsread4.news.pas.earthlink. net>...
Falk Fassmann wrote:
Hello people,

I have some problem with Debugging in MS Visual C++.
I want to generate a TCP/IP-Socket. The compiling-process is fine but
when I debugg the project there's occuring some errors like: 'error
LNK2001: Nichtaufgelöstes externes Symbol "unsigned int __stdcall
socket(int,int,int)" (?socket@@$$FYGIHHH@Z)"'

"Nichtaufgelöstes externes Symbol" means "unresolved external symbol"

Here is a smaller C++-file which creates the same error.

#define AF_INET 2 /* internetwork: TCP, etc. */
#define SOCK_STREAM 1 /* stream socket */

void main(){


In C++ main returns int.
unsigned int __stdcall socket(int af, int type, int protocol);


__stdcall is not standard C++. Please leave non-standard things out when
posting here. If the non-standard thing is the problem, then this is the
wrong place to ask.
unsigned int iClient;
iClient = socket(AF_INET, SOCK_STREAM, 0);


Well, I see no definition for the socket() function, so the linker error
is not particularly surprising. You can't use a function if it doesn't
have a definition. Supply a definition and the problem should go away.
}

I think there's some problem with the symbol "__stdcall", that Visual
C++ has a problem with C++- and C-code.


If that's the case then you should ask in a Visual C++ group.

-Kevin

Jul 19 '05 #3
Falk Fassmann wrote:
Thanks for your message, but this isn't solving my problems.
Please don't top-post. Re-read section 5 of the FAQ for posting guidelines.

http://www.parashift.com/c++-faq-lite/

When I leave "__stdcall" out, it occures an other error:
error LNK2001: Nichtaufgelöstes externes Symbol "unsigned int __cdecl
socket(int,int,int)" (?socket@@$$FYAIHHH@Z)

The definition of:
"unsigned int iClient;
iClient = socket(AF_INET, SOCK_STREAM, 0);"

was: "unsigned int __stdcall socket(int af, int type, int protocol);"

now: "unsigned int socket(int af, int type, int protocol);"
This is not a definition. I still think the problem is that there is no
definition for socket(). Where you get that definition and how you
supply it to the linker are not covered by the topic of this group. It
probably is covered in the documentation for the winsock library and
your compiler.

It's the declaration of the function "socket" from winsock.h.


That is not a standard C++ header.

You might consider taking this to a group that discusses WinSock.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7316
by: ozgan.net | last post by:
Hi everyone, I created my first COM object, but I took below errors. Why I didn't use socket functions. I defined *.def file __imp__WSAStartup@8 PRIVATE __imp__socket@12 PRIVATE...
1
6383
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32...
2
5817
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to...
4
6386
by: Sanjay Kumar | last post by:
Folks ! I am working with VC++ after a long time and having problem linking latest xerces 2.7 in VC++ 2005 Express Edition. I have done following: 1. downloaded and unpacked the the...
1
3264
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
2
2734
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
5
2841
by: eberesche | last post by:
Hello, as a novice in ASN.1 I have me to a project in C ++ under use of ASN.1 - structures risquély. One of my colleagues means, this would deal something with masochism ;-). Result should be a DLL...
1
2368
by: mahricky | last post by:
i have the following error msg when i buid one of my cpp projects in visual studio 6. pls help me, it's very urgent. extures.obj : error LNK2001: unresolved external symbol "public: __thiscall...
1
2105
by: Jonas Schneider | last post by:
Heya, don´t know if you know BOINC: it´s a system for distributed computing, therefore distributing work to many computers and creating a little super-computer, see also their homepage:...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.