Thursday, 15 July 2010

c++ - Dependencies and errors when using atoi -



c++ - Dependencies and errors when using atoi -

i given task refactor old project, , in these current days i'm checking dependencies of executables because reasons, changed since 2009, passing 4 14. more specific, job maintain dependencies before 2009, changes code occuring until today.

i tracked downwards instruction causing trouble. it'a function within library used project:

chain(str, pps) char *pps; char *str; { int pp = 0; pp = atoi(pps); // ic sunt leones.

if comment or replace atoi assignment of integer 0, 1 or 3, library compile fine, executable using .lib gives me these errors:

nafxcw.lib(wincore.obj) : error lnk2001: unresolved external symbol __imp__initcommoncontrols@0 nafxcw.lib(wincore.obj) : error lnk2001: unresolved external symbol __imp__dragacceptfiles@8 nafxcw.lib(appcore.obj) : error lnk2001: unresolved external symbol _closeprinter@4 nafxcw.lib(appcore.obj) : error lnk2001: unresolved external symbol _documentpropertiesa@24 nafxcw.lib(appcore.obj) : error lnk2001: unresolved external symbol _openprintera@12 nafxcw.lib(filecore.obj) : error lnk2001: unresolved external symbol __imp__shgetfileinfoa@20 nafxcw.lib(filecore.obj) : error lnk2001: unresolved external symbol _getfiletitlea@12

if otherwise utilize different value assignment, 2, 4 or every other integer, compile correctly , work.

any advice? what's happening here? why unusual behaviour?

edit: apparently problem not atoi. if utilize home made function , take char* , homecoming int or replacing straight sec parameter of function chain int , assigning straight still receive same errors.

you can seek :

include ('limits.h'); int my_getnbr(char *str) { int i; long nbr; int neg; neg = 0; nbr = 0; = 0; if (str[0] == '-') { neg = 1; str++; } while (str[i] >= '0' && str[i] <= '9') { nbr = nbr * 10 + (str[i++] - '0'); if (nbr > int_max) homecoming (0); } homecoming (neg ? (int)nbr * -1 : (int)nbr); }

it's home made atoi like.

edit : int_max alter mann. edit bis : if (nbr > int_max) alter mann 1 time again :)

c++ c visual-c++

No comments:

Post a Comment