Note also that not all examples require this much work. For example, the svm_ex.cpp example
can be compiled with just:
<code_box>
g++ -O3 -I.. svm_ex.cpp
</code_box>
On non-Linux systems like Solaris, you might have to link to other libraries. For example, I have seen systems
where it was also necessary to supply -lnsl or -lsocket options to g++. Additionally, the X11 development
library isn't installed on Ubuntu by default. So if you require it and are using Ubuntu you can install
it by typing:
<code_box>
sudo apt-get install libx11-dev
</code_box>
<h2>Compiling on Windows using gcc</h2>
<p>
The commands for gcc on windows are the same as above but you may also have to link
(via the -l option) to the following libraries: gdi32, comctl32, user32, ws2_32, or imm32.
</p>
<h2>Compiling on Windows using Visual Studio</h2>
<p>
All you need to do is create an empty console project. Then add dlib/all/source.cpp to it and add the
folder containing the dlib folder to the #include search path. Then you can compile any example program
by adding it to your project.
</p>
<center><h1>Preprocessor Directives</h1></center>
<center><h1>Preprocessor Directives</h1></center>
<p>
<p>
...
@@ -103,32 +156,6 @@
...
@@ -103,32 +156,6 @@
</p>
</p>
<center><h1>Compiler Notes</h1></center>
<h2>gcc</h2>
<p>
I generally use the newest version of gcc but most other versions of gcc work just fine also.
</p>
<p>
The command line I generally use is "g++ -D NO_MAKEFILE -lnsl -lpthread file.cpp" I think you need to
tell it to link nsl to make the threading stuff work right, I honestly can't remember what part of
the library requires it I have just been doing it for so long :)
</p>
<p>
If you are using the sockets stuff then on some platforms you need to supply the -lsocket option. Or if you are using the gui stuff you will need to supply the -lX11 option.
</p>
<p>
If you compile on solaris you have to give the -lsocket
option if you use the sockets API.
</p>
<h2>gcc on windows</h2>
<p>
The commands for gcc on windows are the same as above but you may also have to link (via the -l option) to the following libraries: gdi32, comctl32, user32, ws2_32, or imm32.