A library may be either statically linked or dynamically linked. DLLs normally have an associated 'export library' to allow you to link to them. When you for example link libws2_32.a, this is an export library for ws2_32.dll which is part of the operating system.
Not all library files are export libraries for DLLs some are simply static libraries.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a section in the "Please Read" thread on the compile log,
including headers, and linking libraries that goes into this process
in greater detail.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The difference between typing "latest" and typing the actual number is minimal, but the latter is far more useful. We just have to trust that you know what the 'latest' is!?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
naother question why comes sometimes this warning:
warning This file includes at least one deprecated or antiquated header. \
Please consider using one of the 32 headers found in section 17.4.1.2 of the \
C++ standard. Examples include substituting the <X> header for the <X.h> \
header for C++ includes, or <iostream> instead of the deprecated header \
<iostream.h>. To disable this warning use -Wno-deprecated.
and sometimes not. but i don´t change something on code?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are using headers with names such as iostream.h.
This notation has been deprecated (which means it is old and no longer
technically correct) for almost 10 years, since the ANSI standard for
the language first came out.
Take a look at the example "Hello World" that is given in the thread
titled "Please Read Before Posting Question" to see an example of how
the correct header notation can be applied.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The answer to your question is given in the warning message itself! Read it!
The reason you get it sometimes and not others is because being 'only' a warning, the code gets compiled in any case. If you don't change the code you will not see the warning because because unchanged source modules do not get unnecessarily recompiled.
If you use the -Werror option, all warnings are regarded as errors and compilation will fail - so you will get it every time.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Uh? What does that mean. As the message says "consider using one of the 32 headers found in section 17.4.1.2 of the
C++ standard". There are therefore 32 standard headers.
>> what are this libraries which i link.
Libraries (or archives) are collections of previously compiled object code that can be extracted and linked you your application.
>> why isnt that in the header files?
Header files are generally only declarative, not instantiative. One exception is the use of inline code). #include is merely a pre-processor text insertion, the code in the header becomes part of that module, if the code were instantiative, and you included it in multiple separately compiled modules, when you linked that code you would end up with multiple copies of the code.
>> how do i build myself such files?
File->New->Project, then select either Static Library or DLL.
i use the newest version under vista.
my source code looks so:
include <windows.h>
include <winsock2.h>
include <iostream.h>
using namespace std;
int startWinsock()
{
WSADATA wsa;
return WSAStartup(MAKEWORD(2,0),&wsa);
}
int main()
{
long rc;
rc=startWinsock();
if(rc!=0)
{
}
else
{
}
return 0;
}
and this is my compiler log:
Compiler: Default compiler
Building Makefile: "B:\Programing\Socket\Makefile.win"
Führt make... aus
make.exe -f "B:\Programing\Socket\Makefile.win" all
g++.exe socket.o -o "Socket.exe" -L"E:/Dev-Cpp/lib" -L"E:/Dev-Cpp/lib" -llibwsock32 -llibws2_32 -L"E:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"
E:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot find -llibwsock32
collect2: ld returned 1 exit status
make.exe: *** [Socket.exe] Error 1
Ausführung beendet
i included this libwsock libraries. but something is wrong.
thanks for help.
so this libraries are dll toos? what dlls are i know.
A library may be either statically linked or dynamically linked. DLLs normally have an associated 'export library' to allow you to link to them. When you for example link libws2_32.a, this is an export library for ws2_32.dll which is part of the operating system.
Not all library files are export libraries for DLLs some are simply static libraries.
Clifford
When you have a library in a filename
libxyz.a
you link it as follows:
-lxyz
There is a section in the "Please Read" thread on the compile log,
including headers, and linking libraries that goes into this process
in greater detail.
Wayne
The difference between typing "latest" and typing the actual number is minimal, but the latter is far more useful. We just have to trust that you know what the 'latest' is!?
thanks very much.
naother question why comes sometimes this warning:
warning This file includes at least one deprecated or antiquated header. \
Please consider using one of the 32 headers found in section 17.4.1.2 of the \ C++ standard. Examples include substituting the <X> header for the <X.h> \ header for C++ includes, or <iostream> instead of the deprecated header \ <iostream.h>. To disable this warning use -Wno-deprecated.
and sometimes not. but i don´t change something on code?
You are using headers with names such as iostream.h.
This notation has been deprecated (which means it is old and no longer
technically correct) for almost 10 years, since the ANSI standard for
the language first came out.
Take a look at the example "Hello World" that is given in the thread
titled "Please Read Before Posting Question" to see an example of how
the correct header notation can be applied.
Wayne
The answer to your question is given in the warning message itself! Read it!
The reason you get it sometimes and not others is because being 'only' a warning, the code gets compiled in any case. If you don't change the code you will not see the warning because because unchanged source modules do not get unnecessarily recompiled.
If you use the -Werror option, all warnings are regarded as errors and compilation will fail - so you will get it every time.
Clifford
but this is only at iostream, isnt it?
another question what are this libraries which i link. why isnt that in the header files? how do i build myself such files?
>> but this is only at iostream, isnt it?
Uh? What does that mean. As the message says "consider using one of the 32 headers found in section 17.4.1.2 of the
C++ standard". There are therefore 32 standard headers.
>> what are this libraries which i link.
Libraries (or archives) are collections of previously compiled object code that can be extracted and linked you your application.
>> why isnt that in the header files?
Header files are generally only declarative, not instantiative. One exception is the use of inline code). #include is merely a pre-processor text insertion, the code in the header becomes part of that module, if the code were instantiative, and you included it in multiple separately compiled modules, when you linked that code you would end up with multiple copies of the code.
>> how do i build myself such files?
File->New->Project, then select either Static Library or DLL.
See also: http://sourceforge.net/forum/message.php?msg_id=2670009 and http://www.cs.bu.edu/teaching/c/separate-compilation/