Compile & Build from cmd


I try to compile & build my projects from command line for MCVS and MinGw compiler. I have the following questions for both compilers?

1) How to compile & build dll and lib files? (It is my approach but I know it is not correct.)
cl -shared -o myDll1.dll main.cpp
gcc -shared -o myDll2.dll main.cpp -Wl, --out -implib myDll2.lib

2) How to set Library directories and the corresponding libraries before build?

3) How to set dll directories and the corresponding dlls before build?

4) How to compile & build an executable using corresponding dlls and libs?

5) How to build an exe or dll in debug and release mode?

I have been searching them for any specific examples but I couldn't find any elaborate definition or example.

Would you please explain the questions by simple examples similar to 1?

Thanks in advance..
Topic archived. No new replies allowed.