954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Linker Error when using stprintf

Hello,

I was compiling some code and get the following compiler errors:
error C3861: '_stprintf_s': identifier not found
error C3861: '_tcscat_s': identifier not found

I got the code from the MSDN Library:
http://msdn.microsoft.com/en-us/library/dd798640%28VS.85%29.aspx

I tried to find some info about the _stprintf_s and added the header

This got rid of the Compiler Errors but I now have one linker error:
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

Is there a .lib file or something I need to add to the project? Or am I missing something else?

Thanks,

Sam

fussballer
Newbie Poster
19 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

make sure you include stdio.h and that you add main() function. The code in your link is not a complete program.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Thanks for the reply...
I solved the problem by just removing the whole external window and the _strpintf_s etc and replacing it with a simple printf statement to print it to the console window. But yes adding the int main resolved the linker error (Don't know how I missed it the first time:)

Sam

fussballer
Newbie Poster
19 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: