Your setup is fine, and yes you need to specify libraries to resolve your
undefined references.
I’d consider using cmake to avoid having to figure out the necessary
library names yourself:
find_package(Boost REQUIRED COMPONENTS program_options)
target_link_libraries(${PROJECT_NAME} Boost::program_options)

which links to msys64/mingw64/lib/libboost_program_options-mt.dll.a in my
case

Best, Norbert.

On Wed, May 31, 2017 at 2:08 AM Leif AMO <leif....@gmail.com> wrote:

> It's been a while since I installed MinGW-w64 so I can't remember the
> specific installation options selected (thread models, etc), or if that
> is relevant.
>
> I've been able to compile a few relatively simple C and C++ programs.
> Using the MSYS2/MINGW64 shell for program compilation.  Installed boost
> for using pacman under the MSYS2 shell (not MINGW32 or MINGW64).
>
>      pacman -Ss | grep boost
>      mingw32/mingw-w64-i686-boost 1.63.0-1 [installed]
>      mingw64/mingw-w64-x86_64-boost 1.63.0-1 [installed]
>
> I'm able to compile and run a "simple" boost example (simple.cpp.txt [1]
> attached) without errors using:
>
>      g++ simple.cpp -o simple
>
> However, when trying to compile the program_options "first" example
> (po_first.cpp.txt attached), I get a lot of errors (po_first.log.txt).
>
>      g++ po_first.cpp -o po_first
>
> I don't know if I set up MinGW-w64 correctly, or if I need to specify
> includes or libraries to link to on g++ command line.  Any tips
> appreciated.
>
> [1] Note: Attachments given .txt extension in hopes that mailing list
> software doesn't eat the file.  Rename locally as needed.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to