•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 455,962 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,602 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 4581 | Replies: 5
![]() |
•
•
Join Date: Aug 2004
Posts: 76
Reputation:
Rep Power: 5
Solved Threads: 0
Hi everyone,
First of all thank you very much for all the help that you have been providing me. Unfortunately, i am with another bug. This time, i am havinh problems linking OBJ files that uses the following:
#include <stdio.h>
#include <winsock2.h>
#pragma comment(lib, "ws2_32")
When i link them, i get the following errors:
C:\lcc\bin>lcclnk wgate.obj
wgate.obj .text: undefined reference to '_socket@12'
wgate.obj .text: undefined reference to '_send@16'
wgate.obj .text: undefined reference to '_recv@16'
wgate.obj .text: undefined reference to '_WSAGetLastError@0'
wgate.obj .text: undefined reference to '_htons@4'
wgate.obj .text: undefined reference to '_inet_addr@4'
wgate.obj .text: undefined reference to '_gethostbyname@4'
wgate.obj .text: undefined reference to '_connect@12'
wgate.obj .text: undefined reference to '_WSAStartup@8'
wgate.obj .text: undefined reference to '_WSACleanup@0'
N.B: I use the LCC compiler and linker on windowsXP.
First of all thank you very much for all the help that you have been providing me. Unfortunately, i am with another bug. This time, i am havinh problems linking OBJ files that uses the following:
#include <stdio.h>
#include <winsock2.h>
#pragma comment(lib, "ws2_32")
When i link them, i get the following errors:
C:\lcc\bin>lcclnk wgate.obj
wgate.obj .text: undefined reference to '_socket@12'
wgate.obj .text: undefined reference to '_send@16'
wgate.obj .text: undefined reference to '_recv@16'
wgate.obj .text: undefined reference to '_WSAGetLastError@0'
wgate.obj .text: undefined reference to '_htons@4'
wgate.obj .text: undefined reference to '_inet_addr@4'
wgate.obj .text: undefined reference to '_gethostbyname@4'
wgate.obj .text: undefined reference to '_connect@12'
wgate.obj .text: undefined reference to '_WSAStartup@8'
wgate.obj .text: undefined reference to '_WSACleanup@0'
N.B: I use the LCC compiler and linker on windowsXP.
Microsoft-specific pragmas need not work anywhere but with a Microsoft toolchain. What does the LCC documentation say about linking to specific libraries?
#pragma comment(lib, "ws2_32")
•
•
•
•
Originally Posted by Mahen
I use the LCC compiler and linker on windowsXP.
•
•
Join Date: Aug 2004
Posts: 76
Reputation:
Rep Power: 5
Solved Threads: 0
•
•
•
•
Originally Posted by Dave Sinkula
Microsoft-specific pragmas need not work anywhere but with a Microsoft toolchain.What does the LCC documentation say about linking to specific libraries?#pragma comment(lib, "ws2_32")
This is what the LCC help file says:
Libraries Distributed with lcc-win32
These libraries are distributed in the form of ASCII description files « .exp ». These files will be transformed by the installation program into libraries in lcc-win32 format. This is a different format than the format used by Microsoft, so the libraries generated are NOT compatible with Microsoft or other compilers.
To see the contents of each library, look at the corresponding .exp file in the \lcc\buildlib directory.
:rolleyes:
Okay, I Googled and found a reference page. There was documentation there. In it, under the confusing heading of "Configuring the linker", was this.

Okay, I Googled and found a reference page. There was documentation there. In it, under the confusing heading of "Configuring the linker", was this.

- Additional libraries. Here you put a series of libraries you may need separated by spaces.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- linking error (C++)
- Linking 2 files. (C)
- Linking Error (C++)
- Linking Error... (C++)
- Linking error messages when building program (C)
Other Threads in the C Forum
- Previous Thread: passing arrays,reference and value parameters
- Next Thread: Socket programming + porting Unix to Win32



Linear Mode