Link to home
Start Free TrialLog in
Avatar of --TripWire--
--TripWire--

asked on

C++ Compile error - LNK1120 unresolved externals

The following is an example I copied verbatim from the Internet, just to mak sure I wasn't doing anything wrong.  But, I'm getting error LNK 2019: unresolved external symbol
LNK 1120: 1 unresolved externals

and two warnings about how strtok is unsafe.


/* strtok example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[] ="- This, a sample string.";
  char * pch;
  printf ("Splitting string \"%s\" into tokens:\n",str);
  pch = strtok (str," ,.-");
  while (pch != NULL)
  {
    printf ("%s\n",pch);
    pch = strtok (NULL, " ,.-");
  }
  return 0;
}
SOLUTION
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of --TripWire--
--TripWire--

ASKER

Ok weird.  It works for me now too.  Maybe it was something in the syntax I typed.

I'll award points for helping.  However, first, can someone help me tokenize a text file please?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial