473,662 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error LNK2001: Nichtaufgelöste s 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öste s externes Symbol "unsigned int __stdcall
socket(int,int, int)" (?socket@@$$FYG IHHH@Z)"'

"Nichtaufgelöst es 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 2823
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öste s externes Symbol "unsigned int __stdcall
socket(int,int, int)" (?socket@@$$FYG IHHH@Z)"'

"Nichtaufgelöst es 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öste s externes Symbol "unsigned int __cdecl
socket(int,int, int)" (?socket@@$$FYA IHHH@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************ *********@never box.com> wrote in message news:<6E******* *****@newsread4 .news.pas.earth link.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öste s externes Symbol "unsigned int __stdcall
socket(int,int, int)" (?socket@@$$FYG IHHH@Z)"'

"Nichtaufgelöst es 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öste s externes Symbol "unsigned int __cdecl
socket(int,int, int)" (?socket@@$$FYA IHHH@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 __imp__htons@4 PRIVATE __imp__connect@12 PRIVATE __imp__recv@16 PRIVATE
1
6399
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 Debug-------------------- Linking... icarus_camera.obj : error LNK2001: unresolved external symbol _dgels_ icarus_leastsquares.obj : error LNK2001: unresolved external symbol _dgels_ icarus_maths.obj : error LNK2001: unresolved external symbol _dgels_...
2
5829
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 create a dll, using the cl compiler I was getting many unresolved external errors, Example 1 below (8 in total, 7 to do with the registry function calls and 1 from wsprintfA call) as I hadn't included the AdvAPI32.lib file. So I created a LINK...
4
6400
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 library: http://www.apache.org/dist/xml/xerces-c/binaries/xerces-c_2_7_0-windows_2000-msvc_60.zip
1
3284
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, but throws a load of linker errors
2
2749
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 <string>
5
2845
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 which provides the exchange of documents between a DMS and a remote data base. My developing environment is MSVS v.7.1, and the ASN.1 - source texts are generated with the compiler asn1c-0.9.20. Therefore I have in the project cpp-, as well as c...
1
2380
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 Scene::Scene(void)" (??0Scene@@QAE@XZ) textures.obj : error LNK2001: unresolved external symbol "public: __thiscall Robot::Robot(void)" (??0Robot@@QAE@XZ) textures.obj : error LNK2001: unresolved external symbol "public: __thiscall...
1
2122
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: http://boinc.berkeley.edu/. I get the folllowing errors when I want to compile their default application (WinXP, MSVC++E05):
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.