Hi Everyone,

I am trying to print stack-trace using boost HEADER-ONLY. I am using descriptions under Configuration and Build to compile a simple code using QT MinGW32 I also use the below macros to tune boost:

-DBOOST_STACKTRACE_USE_WINDBG -DBOOST_STACKTRACE_USE_ADDR2LINE -DBOOST_STACKTRACE_ADDR2LINE_LOCATION

I have no clue why the function names and line numbers are not showing up.

Any comment is appreciated.
Mike

Below are compile and build instructions:

g++  -g3 -DBOOST_STACKTRACE_USE_WINDBG -DBOOST_STACKTRACE_USE_ADDR2LINE -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=C:\Qt_5_12\Tools\mingw730_32\bin\addr2line.exe -I../../../boost_1_73_0 -c main.cpp -omain.o

g++ main.o -o stack_traces.exe -L"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86" -L"C:\temp\libbacktrace" -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -luuid -lodbc32 -lodbccp32 -lDbgEng

And here is the output ... 

 0# 0x00402C75 in stack_traces
 1# 0x00401602 in stack_traces
 2# 0x004016CE in stack_traces
 3# 0x0040138B in stack_traces
 4# _BaseThreadInitThunk in KERNEL32
 5# _RtlGetAppContainerNamedObjectPath in ntdll
 6# _RtlGetAppContainerNamedObjectPath in ntdll
1 + 2 = 3

The code (main.cpp)

Is fairly simple as below:

#include <iostream>
#include <boost/stacktrace.hpp>

double add(double a, double b){
      std::cout << boost::stacktrace::stacktrace();
      std::cout << a << " + " << b << " = " << (a+b) << std::endl;
      return a+b;
}

int main(){
     add(1,2);
     return 0;
}