dimanche 19 avril 2015

moved from cygwin to VisualStudio2013, error LNK2019, snprintf(), c

I'm trying to run a unix compiler-project written in c with MS Visual-Studio 2013 and I can't get rid of the following error:



error LNK2019: unresolved external symbol "_snprintf" referenced in
function "PUBLIC void SyntaxError( int Expected, TOKEN CurrentToken )"


If I get it right it is a problem where VisualStudio can't find the body/declaration from the snprintf() function, which should be defined in stdio.h.


The project works fine with cygwin. I had to add _CRT_SECURE_NO_WARNINGS to preprocessor settings to get this far, but i don't think that has a influence.


Here is the named function:



#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "line.h"
#include "strtab.h"
#include "scanner.h"

[..code..]


PUBLIC void SyntaxError( int Expected, TOKEN CurrentToken )
{
char s[M_LINE_WIDTH+2];

snprintf( s, sizeof(s), "Syntax: Expected %s, got %s\n", Tokens[Expected], Tokens[CurrentToken.code] );
Error( s, CurrentToken.pos );
}


If you can help me or there is anything else you need to know please tell me. It's my 3rd day now and I am running out of ideas ;).


So far... Tobias


Aucun commentaire:

Enregistrer un commentaire