Hello all,
Any help would be great. I've created a Carbon static library (mylib.a) and in it is a c++ function called MyBeep(). I've also created a gcc cpp app which will call MyBeep(). I know I can add the MyBeep() source to my app and use the '-framework carbon' flag to compile everything into 1 app, but I want a separate lib and executable.
The issue is the linker is unable to locate MyBeep() from within mylib.a. When I link using
gcc -o myexe file1.o file2.o mylib.a
I get:
Undefined symbols"
"_MyBeep", referenced from _Test in file1.o
ld: symbol(s) not found
When I display name list (symbol table) via unix command 'nm' for the mylib.a, I get:
mylib.a(carbon.o):
00007a8 s EH_fram1
U _SysBeep
0000000 T __Z6MyBeepv
00007c4 S __Z6MyBeepv.eh
U __gx_personality_v0
Displaying the name list for the file1.o that calls MyBeep() yields:
0000020 T _Test
U _MyBeep
So some name mangling is occurring. I tried numerous variations of call MyBeep() from with test.c (_MyBeep, _Z6MyBeepv, __Z6MyBeepv, etc) and havent been able to determine the right convention.
Anyone have any ideas?
I should also note mylib.a was created via xcode.
Any help would be great. I've created a Carbon static library (mylib.a) and in it is a c++ function called MyBeep(). I've also created a gcc cpp app which will call MyBeep(). I know I can add the MyBeep() source to my app and use the '-framework carbon' flag to compile everything into 1 app, but I want a separate lib and executable.
The issue is the linker is unable to locate MyBeep() from within mylib.a. When I link using
gcc -o myexe file1.o file2.o mylib.a
I get:
Undefined symbols"
"_MyBeep", referenced from _Test in file1.o
ld: symbol(s) not found
When I display name list (symbol table) via unix command 'nm' for the mylib.a, I get:
mylib.a(carbon.o):
00007a8 s EH_fram1
U _SysBeep
0000000 T __Z6MyBeepv
00007c4 S __Z6MyBeepv.eh
U __gx_personality_v0
Displaying the name list for the file1.o that calls MyBeep() yields:
0000020 T _Test
U _MyBeep
So some name mangling is occurring. I tried numerous variations of call MyBeep() from with test.c (_MyBeep, _Z6MyBeepv, __Z6MyBeepv, etc) and havent been able to determine the right convention.
Anyone have any ideas?
I should also note mylib.a was created via xcode.
Last edited by a moderator: