Using g++ to link to libraries

I have never tried using command line to compile programs before, but it seems more flexible so I want to give it a shot, but everyone seems to have a different way of how they order their commands in command line, which makes it difficult to understand by examples.

I want to two .a libraries that are in a different file from my .cpp

but when I try the following commands
 
g++ -c main.cpp -L"C:\gcc\boost_1_57_0\stage\lib" -lboost_system-mgw48-mt-1_57     -lboost_filesystem-mgw48-mt-1_57

I get the error
1
2
3
4
main.cpp:1:32: fatal error: boost/filesystem.hpp: No such file or directory
#include <boost/filesystem.hpp>
                               ^
compilation terminated.


Could anyone explain, what is wrong with my argument and how would I fix it.
You also need to give a path to boost headers with -I, like
-I E:\Users\MiiNiPaa\home\Developement\lib\c++\BOOST\boost_1_54_0
(I use -isystem to suppress ungodly amount of warnings boost tends to generate)
You should try also specifying the...i think -I options for each of possible boost library's include directories
@MiiNipaa
@tanezavm

Thanks that was a big help, by the way would I have to transfer this exe to another computer to test if it was linked statically, or does automatically using .a mean it was linked staticanlly?
Topic archived. No new replies allowed.