Log in

View Full Version : Zone Compiling Error


Elysius
04-22-2020, 02:43 PM
Today I was trying to make some changes to my old server code, specifically to add Attack Delay that was put in back in 2014 (like I said, old). I backed up my zone folder in case things didn't work out, which they didn't as I assume there was some other update required to make the new code work. So I figured no problem, I'll just go back to my original code.

But ever since I did this, I can't compile anymore. Even with my code back to the way it was before. I keep getting this error:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Build started: Project: zone, Configuration: Debug Win32 ------
2>horse.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NPC::SetAttackTimer(void)" (?SetAttackTimer@NPC@@UAEXXZ)
2>merc.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NPC::SetAttackTimer(void)" (?SetAttackTimer@NPC@@UAEXXZ)
2>npc.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NPC::SetAttackTimer(void)" (?SetAttackTimer@NPC@@UAEXXZ)
2>pets.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NPC::SetAttackTimer(void)" (?SetAttackTimer@NPC@@UAEXXZ)
2>C:\EQ\Source\Build\Bin\Debug\zone.exe : fatal error LNK1120: 1 unresolved externals
3>------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
3> Build all projects
========== Build: 2 succeeded, 1 failed, 9 up-to-date, 0 skipped ==========



Which is strange because the SetAttackTimer was what was being editted. But I've since replaced those edits with my original backed up code.

Uleat
04-22-2020, 03:55 PM
Make sure that you do a Clean before attempting to Build.

Looks like the pre-compiled obj files still hold a reference to an external link that doesn't exist.

Elysius
04-22-2020, 04:30 PM
Make sure that you do a Clean before attempting to Build.

Looks like the pre-compiled obj files still hold a reference to an external link that doesn't exist.

Thanks, that was it! My knowledge of this stuff is even more limited than I thought :D

joligario
04-22-2020, 05:33 PM
Debug Win32
May want to select RelWithDebInfo as well.

Uleat
04-23-2020, 03:41 PM
I should follow-up and say that you can 'usually' get away with performing a Build without having to do a Clean beforehand.

Any time that you alter or remove a pre-decl/hint like that, it's possible the compiler will not pick up the reference change in the obj file.

If the unresolved external symbol error pops up after a change on code that has previously compiled, a Clean would be my first recommendation.

If the Clean does not resolve it, then there is a linkage error that needs to be addressed.

Usually, the only real problem you'll see by not performing a Clean with every build is bin bloat (artificially increased size of bins.)

Rare occasions, you can actually get errors.

I use the Build-only method on my dev code until I'm happy with its performance .. then do a full Clean-Build to make sure everything is still ok.