Im trying to learn sockets in either c or c++. I'm trying to just get a working sockets example to start first of all. http://msdn.microsoft.com/en-us/library/ms737889(VS.85).aspx
is an example of full server and client code but i dont know how to link the files: such as said...
// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
i've tried project->project options->parameters->linker
and either or
-wsock32.lib wsock32.lib
-Mswsock.lib Mswsock.lib
-Advapi32.lib Advapi32.lib
and it still doesnt quite work i get [quote] C:\Dev-Cpp\Makefile.win [Build Error]["../Users/Admin/Downloads/echo_apps/New Folder/tcp_client.o"] Error 1 [/quote]
I've looked up the faq about linking items and it just says to add them to the linker box and not in what form. Is it possible i dont have these files and need to download them? i was under the presumption from multiple articles that you should have them automaticly
thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Where MS documentation ( http://msdn.microsoft.com/en-us/library/ms741394(VS.85).aspx ) says to link libXXX.a, in GNU you link libXXX.a instead. To do this use the -lXXX option (the lib prefix and -a sufix are assumed), or specify the library in full. For -lXXX to work, the path to teh library must be specified in a -L<path> switch (add the paths project->project options->directories->libraries). The standard paths are already added by default.
That does not help much. Post the whole log. That just means the build failed. The earlier part of the log will indicate why. The complete log is on the Compile Log tab. That is what you should post here.
> i was under the presumption from multiple articles that you should have them automaticly
Microsoft's project templates link pretty much every possible Win32 API library by default (at the expense of extended build time). Dev-C++ only links the C/C++ standard libraries by default. Everything else you must explicitly link. Which means knowing which library any function you use exists in; this is where teh MSDN documentation, and the XXX.lib ->libXXX.a transform comes in.
Clifford
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The solution to your problem (getting Dev-C++ to work on Vista) is in the "PLEASE READ BEFORE POSTING A QUESTION" thread.
Also there is plenty of other advice you need to read; like not using prohect paths containing spaces!
I don't know why you thought this was a problem with linking libraries. Your log shows that compilation failed, so the linker has not yet even been invoked! You mignt have a problem with linking when you get that far, but you have not got that far yet. This is why you should always post the log. And because this is a Vista specific issue your OS version. All this is mentioned in the "PLEASE READ BEFORE POSTING A QUESTION" thread.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i apologise im only starting to explore c++ and still unsure exactly what the full log means. i did infact read the "read before posting" but for the information i was given came to the inexperienced conclusion that it was linkers that were wrong. Thank you for the direction but bare in mind that for the novice who isnt as adept at picking out what information is relevant and understanding its meaning problems can be precieved to be from other sources and any information we read might not impact us as we do not understand the details of our problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Given that you are just getting started with C++, I would like to
humbly suggest that you might want to start a little simpler than
a sockets program as the first thing you try to compile.
Every time I install a new compiler (even Dev), the first thing
I try to do is see if I can get a simple, stupid "Hello World"
program to compile and run properly - starting simple with
something that you know works is a good debugging practice.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Im trying to learn sockets in either c or c++. I'm trying to just get a working sockets example to start first of all.
http://msdn.microsoft.com/en-us/library/ms737889(VS.85).aspx
is an example of full server and client code but i dont know how to link the files: such as said...
// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
i've tried project->project options->parameters->linker
and either or
-wsock32.lib wsock32.lib
-Mswsock.lib Mswsock.lib
-Advapi32.lib Advapi32.lib
and it still doesnt quite work i get
[quote] C:\Dev-Cpp\Makefile.win [Build Error] ["../Users/Admin/Downloads/echo_apps/New Folder/tcp_client.o"] Error 1 [/quote]
I've looked up the faq about linking items and it just says to add them to the linker box and not in what form. Is it possible i dont have these files and need to download them? i was under the presumption from multiple articles that you should have them automaticly
thank you
> i apologise im only starting to explore c++ and still
> unsure exactly what the full log means.
That is exatly why you are asked to post it! So we can explain it.
Where MS documentation ( http://msdn.microsoft.com/en-us/library/ms741394(VS.85).aspx ) says to link libXXX.a, in GNU you link libXXX.a instead. To do this use the -lXXX option (the lib prefix and -a sufix are assumed), or specify the library in full. For -lXXX to work, the path to teh library must be specified in a -L<path> switch (add the paths project->project options->directories->libraries). The standard paths are already added by default.
So you need:
-lws2_32 -lmswsock -lwsock32 -ladvapi32
> [quote] C:\Dev-Cpp\Makefile.win [Build Error] ["../Users/Admin/
> Downloads/echo_apps/New Folder/tcp_client.o"] Error 1 [/quote]
That does not help much. Post the whole log. That just means the build failed. The earlier part of the log will indicate why. The complete log is on the Compile Log tab. That is what you should post here.
> i was under the presumption from multiple articles that you should have them automaticly
Microsoft's project templates link pretty much every possible Win32 API library by default (at the expense of extended build time). Dev-C++ only links the C/C++ standard libraries by default. Everything else you must explicitly link. Which means knowing which library any function you use exists in; this is where teh MSDN documentation, and the XXX.lib ->libXXX.a transform comes in.
Clifford
Clifford
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -DDEBUG -c "../Users/Admin/Downloads/echo_apps/New Folder/tcp_client.cpp" -o "../Users/Admin/Downloads/echo_apps/New Folder/tcp_client.o" -I"C:/Dev-Cpp/include" -g3
gcc.exe: installation problem, cannot exec `cc1plus': No such file or directory
make.exe: *** ["../Users/Admin/Downloads/echo_apps/New Folder/tcp_client.o"] Error 1
Execution terminated
full log
What OS are you running?
Wayne
windows vista
There are issues with getting Dev working with Vista.
Instructions on dealing with them are in the thread titled
"Please Read Before Posting a Question"
Please take some time and look through the information there.
Wayne
The solution to your problem (getting Dev-C++ to work on Vista) is in the "PLEASE READ BEFORE POSTING A QUESTION" thread.
Also there is plenty of other advice you need to read; like not using prohect paths containing spaces!
I don't know why you thought this was a problem with linking libraries. Your log shows that compilation failed, so the linker has not yet even been invoked! You mignt have a problem with linking when you get that far, but you have not got that far yet. This is why you should always post the log. And because this is a Vista specific issue your OS version. All this is mentioned in the "PLEASE READ BEFORE POSTING A QUESTION" thread.
Clifford
i apologise im only starting to explore c++ and still unsure exactly what the full log means. i did infact read the "read before posting" but for the information i was given came to the inexperienced conclusion that it was linkers that were wrong. Thank you for the direction but bare in mind that for the novice who isnt as adept at picking out what information is relevant and understanding its meaning problems can be precieved to be from other sources and any information we read might not impact us as we do not understand the details of our problem.
Given that you are just getting started with C++, I would like to
humbly suggest that you might want to start a little simpler than
a sockets program as the first thing you try to compile.
Every time I install a new compiler (even Dev), the first thing
I try to do is see if I can get a simple, stupid "Hello World"
program to compile and run properly - starting simple with
something that you know works is a good debugging practice.
Wayne