Page 1 of 1
Linker error: Symbol not defined
Posted: June 27th, 2023, 6:48 am
by PolybiusProxy
Hi there, I'm getting the following linker errors:
Code: Select all
C:\PSYQ\LIB\LIBSN.LIB : Error : Symbol '__do_global_dtors' not defined
C:\PSYQ\LIB\LIBSN.LIB : Error : Symbol '__bb_exit_func' not defined
C:\PSYQ\LIB\LIBSN.LIB : Error : Symbol '_cleanup' not defined
I'm using PSY-Q 4.7. I tried with the altered PSY-Q SDK and the Programmers Tool CD 2.2, by extracting the 4.7 runtime on them.
Can anyone help? Thanks.
Re: Linker error: Symbol not defined
Posted: June 27th, 2023, 11:59 am
by Administrator
What's your
PSYQ.INI file look like? This is mine for 4.7.
Code: Select all
[ccpsx]
stdlib=libgs.lib libgte.lib libgpu.lib libspu.lib libsnd.lib libetc.lib libapi.lib libsn.lib libc.lib libcd.lib libcard.lib libmath.lib libds.lib libpress.lib libpad.lib libtap.lib libgun.lib libsio.lib libmcrd.lib
compiler_path=C:\psyq\bin
assembler_path=C:\psyq\bin
linker_path=C:\psyq\bin
library_path=C:\psyq\lib
c_include_path=C:\psyq\include
cplus_include_path=C:\psyq\include
If you still get the linker errors after verifying
libsn.lib is present in your INI, then include the correct header in your C or C++ file you're linking. The linker is literally telling you it cannot find (for example)
_cleanup in your compiled object because the header is most likely missing.
If you're using
PSYLINK.EXE, then also make sure you check and edit the linker file. On Windows, it is overlooked because of the *.LNK extension so don't be fooled if it looks like a shortcut or garbage file.
Example:

Re: Linker error: Symbol not defined
Posted: June 27th, 2023, 4:28 pm
by PolybiusProxy
Hi,
My
PSYQ.INI file looks almost the same. All the paths match, the only different things are some missing libs like libmcrd.lib. Added all of them just in case, and I'm still getting the errors.
The headers and the libs I'm using are from the PSY-Q 4.7 runtime ZIP from the Downloads page.
I don't see any *.LNK file in my project.
Here's my MAKEFILE.MAK, if it helps:
Code: Select all
all:
del main.exe
cls
ccpsx -Xo0x80010000 -Wall game/*.cpp -I game -o main.cpe
cpe2x /ce main.cpe
Re: Linker error: Symbol not defined
Posted: June 28th, 2023, 4:54 pm
by Administrator
Don't include
libmcrd.lib unless you need it as it'll just bloat your CPE/EXE. The same goes for any other libs if you're not using them.
Not sure what's going on, but try replacing
libsn.lib with the 4.6 version instead. It looks like mine is from
Wednesday, 28 July 1999 compared to
Friday, 18 February 2000 for all my other libs (which are 4.7) so maybe I did replace my
libsn.lib with 4.6 because I had the same problem (I cannot remember though)
Psy-Q V4.6 LIBSN.LIB (Wednesday, 28 July 1999)
LIBSN.LIB
Re: Linker error: Symbol not defined
Posted: June 29th, 2023, 9:48 am
by PolybiusProxy
Thanks! That fixed it.