Find class object in a library file

You may get a linker error that says a sysbol was not found during linking stage. This is problely because some library was not added rightly.

Here is a bash script to find which library is the missing  class symbol in.

!/bin/bash

function doDir()
{
    for file in "$1"/*
    do
        if [ -f "$file" ]
        then
            if [[ "$file" =~ .+\.a$  ]]
            then
                oList=( $(ar -t $file) )
                for oFile in "${oList[@]}"
                do
                    if ( echo  "$oFile" | grep $2 >> /dev/null )
                    then
                        echo $file $oFile
                    fi

                done
            fi

        elif [ -d "$file" ]
        then
#if "$file" != "." and "$file" != ".."
#           then
                doDir $file $2
#           fi

        fi
    done
}

doDir $1 $2

  

posted @ 2024-03-11 14:02  huorexiaji  阅读(26)  评论(0)    收藏  举报