Reciving a undefined refrence for glslang functions with g++

hello, i’m trying to incorporate the glslang c++ api into my program, however i am getting an error

undefined reference to glslang::InitializeProcess();

i have both tried installing glslang from source building and installing it into normal system-wide libs (my .a are in the proper places in usr/ locations… and my include libs are in the right place.
just to make sure i did not do something wrong i ALSO tired from apt-get repository the glslang-dev which also installed… still same error. on the command line it finds the librarys with the -l flag. i assume i’m missing a step, or need a particular path? or, do i need to include some particular folder into an external folder? is it just not possible to do this via g++? and need to use cmake (i’d prefer not to at this point). as i’m not so good at it yet, and i have other library issues, with cmake vs at the moment everything else works nicely and i’m still in the process of making lots of files, and changes. would rather stick to my g++ comple method. i’ve had diffcult finding examples that use just comand lines for compling… any help be thankful!

g++ -std=c++17 main.cpp vulkan_api.cpp vk_abstracionz.cpp vk_shaderz.cpp glad/src/vulkan.c exrtn_vulkan.cpp -o vlkantest.out -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -lxcb -lglslang -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools

in my hpp.

#include <glslang/Public/ShaderLang.h>
#include <glslang/SPIRV/GlslangToSpv.h>
#include <glslang/SPIRV/spirv.hpp>
...
class parser_vulkan_modual{
...
    void init_glslang();
...
};

code in my .cpp

 void parser_vulkan_modual::init_glslang()
{
    if (!glslangInitialized)
    {   
        glslangInitialized = glslang::InitializeProcess();
       // glslangInitialized = ShInitialize(); - i also tried to see if i this would work... 
    }
}

i’ve tried with a make file… same result
the libglslang.a located in usr/local/lib is present. (i have also tried with -L /usr/local/lib just incase and when i do objdump -t libglslang.a

i can find the symbol

`0000000000000010 g     F .text	0000000000000015 glslang_initialize_process

CXX = g++
CXXFLAGS = -Wall -g -std=c++17
LIBS = -lglslang -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -lxcb -lglslang -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools

OBJ = main.o vulkan_api.o vk_abstracionz.o vk_shaderz.o exrtn_vulkan.o

vlkantest: ${OBJ}
${CXX} ${CXXFLAGS} -o $@ main.o vulkan_api.o vk_abstracionz.o vk_shaderz.o exrtn_vulkan.o ${LIBS}

main.o: main.cpp vk_shaderz.hpp vulkan_api.hpp

vulkan_api: vulkan_api.cpp vulkan_api.hpp

vk_abstracionz: vk_abstracionz.cpp vk_abstracionz.hpp

vk_shaderz: vk_shaderz.cpp vk_shaderz.hpp

exrtn_vulkan: exrtn_vulkan.cpp exrtn_vulkan.hpp

try

gcc --print-file-name libglslang.a

if your library is set correctly, it will show a full path to the library. On my archlinux setup will give the following path.

/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/libglslang.a

By the way, the symbol for c++ is definitely not glslang_initialize_process, this is for c api. The c++ symbol is mangled by some certain rule(depends on your compiler and platform), this is called name mangling, you can search for more infos. In gcc world, It will look like this:

objdump -t /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/libglslang.a |rg InitializeProcess
0000000000001950 g     F .text  0000000000000014 _ZN7glslang17InitializeProcessEv
0000000000000000         *UND*  0000000000000000 _ZN7glslang17InitializeProcessEv

Hope you can solve the problem, best wishes!

when i do

gcc --print-file-name libglslang.a

i get

/usr/lib/gcc/x86_64-linux-gnu/9/…/…/…/x86_64-linux-gnu/libglslang.a

and ah i was wondering if that was the c or c++ symbol makes sense it be mangled.
when i search the lib. i find

0000000000000000 UND 0000000000000000 _ZN7glslang17InitializeProcessEv

so though the lib is not the same one i was thinking it was (in the other usr/local/lib etc. this one that it is linking too is very much present.

Nothing else except this UND?
*UND* means: if the section is referenced in the file being dumped, but not defined there.
The right one should be F .text which means this is a function and is a text segment.