473,396 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to link libws2_32.a?

12
Hi,

I have a problem to compile my socket program.
I want to use winsock.h.
I need link libws2_32.a (for dev-c++) .
I found a libws2_32.a file and link it, but i have a next error:
....
gcc: c:\documents and settings\ervin\asztal\programming tcp sockets for the beginner\source code\dev-c++\chat1.rc: linker input file unused since linking not done
gcc: libws2_32.a: linker input file unused since linking not done
....


What can I do ?
Please let me know.

Thanks,

Takeshi Honda
Sep 22 '07 #1
11 14185
gcc: c:\documents and settings\ervin\asztal\programming tcp sockets for the beginner\source code\dev-c++\chat1.rc: linker input file unused since linking not done
gcc: libws2_32.a: linker input file unused since linking not done
....
Hi, the message you get is a GCC warning.
Linking is done at the linking step, this message usually appears when you specify linking flags at compiling : gcc -c johndoe.c -o johndoe.o -Lpath/to/mylibrary -lmylibrary.
These -L and -l flags have no sense there, they should be used when building the target binary : gcc johndoe.o otherfile.o -o mybinary -L... -l...
or passed to ld if you call it manually.
Sep 22 '07 #2
kiberg
12
Thanks,
I linking folowing files:
libws2_32.a Chat1.cpp Chat1.rc Chat1.h

but is a new error:

gcc: Compilation of header file requested

This error show when I linking chat1.h..But if I don't linking it then showing following errors:

gcc: libws2_32.a: linker input file unused since linking not done
gcc: Chat1.rc: linker input file unused since linking not done


Please help me!
Sep 23 '07 #3
Please tell me the full command you're using when running GCC.
Sep 23 '07 #4
kiberg
12
I only wrote file names...
So, dev c++ -> options -> copiler options -> Add the following comands when calling copiler, and I write following:
libws2_32.a Chat1.cpp Chat1.rc Chat1.h

I dont write commands....
I probaly following:
gcc -a libws2_32.a -cpp Chat1.cpp -rc Chat1.rc -h Chat1.h

But I get following errors:
gcc: gcc: No such file or directory
gcc: unrecognized option `-cpp'
gcc: unrecognized option `-rc'
gcc: unrecognized option `-h'
gcc: Compilation of header file requested

I dont understand it.:S
Sep 23 '07 #5
kiberg
12
and if I write following:
gcc -c libws2_32.a -c Chat1.cpp -c Chat1.rc -c Chat1.h

Then retry only is a error:
gcc: Compilation of header file requested...........
Sep 23 '07 #6
Try this :

gcc Chat1.cpp Chat1.rc -o Chat1.exe -L/path/to/library/if/not/in/same/directory -lws2_32
Sep 23 '07 #7
If this doesn't work, try adding option -mwindows
Sep 23 '07 #8
kiberg
12
Copiler and linker output:

C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:29: multiple definition of `WinMain@16'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:29: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `GetTextandAddLine(char *, HWND__ *, int)':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:38: multiple definition of `GetTextandAddLine(char *, HWND__ *, int)'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:38: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `DlgProc(HWND__ *, unsigned int, unsigned int, long)':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:48: multiple definition of `DlgProc__FP6HWND__UiUil@16'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:48: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `ConnectDlgProc(HWND__ *, unsigned int, unsigned int, long)':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:190: multiple definition of `ConnectDlgProc__FP6HWND__UiUil@16'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:190: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `ListenDlgProc(HWND__ *, unsigned int, unsigned int, long)':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:249: multiple definition of `ListenDlgProc__FP6HWND__UiUil@16'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:249: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `ListenOnPort(int)':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:329: multiple definition of `ListenOnPort(int)'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:329: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `TryConnect(long, int)':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:289: multiple definition of `TryConnect(long, int)'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:289: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:29: multiple definition of `Title'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:29: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:30: multiple definition of `hInst'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:30: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:33: multiple definition of `fromlen'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:33: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:29: multiple definition of `hwnd'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:29: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:29: multiple definition of `hStatus'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:29: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:30: multiple definition of `s'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:30: first defined here
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccUfdaaa.o: In function `WinMain':
//C/Documents and Settings/ervin/Asztal/Programming TCP Sockets for the Beginner/Source Code/Dev-C++/Chat1.cpp:30: multiple definition of `from'
C:\DOCUME~1\ervin\LOCALS~1\Temp\ccYtcaaa.o://c/docume~1/ervin/asztal/progra~1/source~1/dev-c_~1/chat1.cpp:30: first defined here

Why don't work?
Sep 26 '07 #9
lksiow
1
@kiberg





Hi Takeshi Honda,

I am a beginner in programming. Can u kindly instruct me on how to link libws2_32.a to the project?

Thank you in advance.

Cheers
Siow
Jun 18 '09 #10
donbock
2,426 Expert 2GB
@kiberg
The -c switch means compile or assemble the following file, but do not link. You definitely don't want to compile libsw2_32.a or Chat1.h. Personally, I typically use the -c switch when I'm using individual gcc invocations to compile each source file. You don't need it when you specify all of the source files on a single line.

I'm not familiar with the .rc suffix, what kind of file is Chat1.rc?
Jun 18 '09 #11
newb16
687 512MB
That message is 2 years old btw.
Jun 19 '09 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

26
by: Harrie | last post by:
Hi, After Brian mentioned the use for <link rel=..> for navigational purposes in another thread, I've been looking into it and found that HTML 3.2 has two other recognized link types than HTML...
4
by: Franklin | last post by:
WITHOUT KNOWING ANYTHING ABOUT THE CURRENT COLORS, I want to swap the foreground/background colors of a link when someone hovers over it. Is this possible with HTML, CSS, DOM, & JavaScript? If...
8
by: sudhirlko2001 | last post by:
How to swap two nodes of doubly Linklist
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
1
by: sri2097 | last post by:
Hi all, I have written a Link list implementation in Python (Although it's not needed with Lists and Dictionaries present. I tried it just for the kicks !). Anyway here is the code - # Creating...
8
by: Steve | last post by:
Hi; I had a big link checking job to do and it has been years since I have done anything like that so I found a test page to use that I knew had bad links on it( a friends site ) and I decided...
7
by: gehegeradeaus | last post by:
Can someone help me to make a regular expression for this sort of replacement : text with {link:pagehref}a link{/link}. replace to -> text with <a href="pagehref">a link</a> I tried...
7
by: Kurda Yon | last post by:
Hi everybody, I cannot understand the following thinks. The last line of the fillowing code produces a message about mistake (not a valid MySQL- Link resource): $link = mysql_connect(...
4
by: perryche | last post by:
Is this possible? Instead of using the link wizard, can the FE/BE link be established any other way that users can simply type the link path? Thanks, Perry
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
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
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,...

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.