| | |
Linking Error In C
![]() |
•
•
Join Date: Aug 2004
Posts: 140
Reputation:
Solved Threads: 2
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?
C Syntax (Toggle Plain Text)
#pragma comment(lib, "ws2_32")
•
•
•
•
Originally Posted by Mahen
I use the LCC compiler and linker on windowsXP.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
Join Date: Aug 2004
Posts: 140
Reputation:
Solved Threads: 2
•
•
•
•
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?C Syntax (Toggle Plain Text)
#pragma comment(lib, "ws2_32")
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.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- g++ - linking error - undefined reference to <func_name> (C++)
- I keep getting an unresolved linking error, need help (C++)
- Linking error in the compiler given by topcoder. Plz help me out guys. (C++)
- linking error (C++)
- Linking Error (C++)
Other Threads in the C Forum
- Previous Thread: passing arrays,reference and value parameters
- Next Thread: Socket programming + porting Unix to Win32
| Thread Tools | Search this Thread |
* adobe api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking hardware highest homework i/o ide inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h






