Nonintuitive linker errors in Studio ’05

Yesterday I was working on a project using C++ for a device under Visual Studio ’05 and for some reason it stopped linking with the following error:

error LNK2019: unresolved external symbol __security_check_cookie referenced in function “int __cdecl RegisterAndActivate(void)” (?RegisterAndActivate@@YAHXZ)

No idea even what the error meant, so I messed with some settings, rolled back code – all the usual things to try to find it.  Nothing.  I decided to bag it for the night – maybe fresh eyes today would help.

I loaded the project again today.  Same error.  I removed the project from the solution, created a new one, and re-added my code. Same error.  So I turned to my fellow coders to see if anyone else had seen this.

Jeff Abraham of Microsoft replied as follows:

My psychic powers tell me that you are building against PPC2003, and you aren’t linking against secchk.lib. Try adding that to the linker inputs line, and seeing if that fixes the issue. I’m not sure how you would have gotten into this state without changing anything, as any project targeting PPC/SP 03 should have these libraries by default.

Sure, enough, I added secchk.lib to the Additional Dependencies line under the Project’s Linker | Input section and it’s now building again.  Why the error occured in the first place I’m not too concerned with – the release of Studio is only weeks away and I’ll be uninstalling soon, but Googling on this error turned up nothing helpful at all.  Hopefully this blog entry will remedy that if someone else is looking.

2 thoughts on “Nonintuitive linker errors in Studio ’05”

  1. I meant to follow up on this earlier, but I think that it’s likely you ended up inserting a block of code in your function that triggered the compiler automatically inserting this call. I suspect that the compiler is smart enough not to reference _security_check_cookie if it can prove that the current function cannot blow the stack. Cheers!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s