English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

it tells me i have unresolved externals
#include
#include
#include
#include
#include

char * vowel_rule(char *);
char * two_letter(char *);
char * last_rule(char *);
void rules();

int main()
{

rules();

return(0);
}

void rules()
{
char str[80];
char english[80];
int length,a,b,i;

i=0;
a=b=0;

printf("Please enter a phrase to be translated to piglatin: ");
fgets(str,79,stdin);
length = strlen(str);

printf("\nThis is your translated sentence: ");

while(a<=length)
{
english[b]=str[a];
if(english[b]==' '||english[b]=='\0')
{
english[b]='\0';
b=0;

if(english[0]=='A'||english[0]=='E'||english[0]=='I'||english[0]=='O'||english[0]=='U'||english[0]=='a'||english[0]=='e'
||english[0]=='i'||english[0]=='o'||english[0]=='u')
{
printf(" %s",vowel_rule(english));
}

char * vowel_rule(char *str)
}
static char temp[80];
strncopy(temp,'\0',80);
strcpy(temp,str);
temp[strlen(temp)+1]= '\0';

2007-12-10 14:29:15 · 6 answers · asked by matt n 1 in Computers & Internet Programming & Design

more specifically the error is....

1>Linking...
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals

those are the two errors. If anyone owns microsoft visio for C, try copying and pasting the program to run it on your own. i've spent the last several hours trying to figure these errors out and any help would be appreciated. the purpose of this program is to convert english into pig latin. Thanks.

2007-12-10 15:04:42 · update #1

i cant even enter anything in it. it will not even pull up the printed screen.

2007-12-10 16:16:18 · update #2

no i cant see the output of the compiler

2007-12-10 16:17:17 · update #3

6 answers

The reference to strncopy should be to strncpy. I'm surprised the linker didn't give you a bit more information than it did, though.

But the strncpy doesn't do anything anyway. The strcpy from str into temp immediately overwrites the single \0 it would put down

Hope that helps.

2007-12-10 14:46:58 · answer #1 · answered by The Phlebob 7 · 0 0

What is that at the end after the line "char * vowel_rule(char *str)"?

Theres a closing brace but no opening brace, and even if that were right, it doesn't return anything. Did it get gorped up when you copied it here?

Not to mention that I count 4 opening braces in rules(), and only 1 closing brace.

Update: I'm not familiar with your build environment, but I don't think your program compiled. Can you see the output from your C compiler? Try putting something in the code you know is an error, like "Hi, Mom!", and see if it does the same thing.

Update again: Sorry, but this program is a train wreck. I think you should start by writing a "Hello World" program, and getting that to compile and run. Then start expanding it a little at a time to get it to do what you want.

2007-12-10 22:48:43 · answer #2 · answered by Whatever 3 · 0 0

It would be useful if you provided more information:

1) The commands you are running to compile and link the program (unless you are using an IDE)
2) The exact error message - does it list the symbols?

2007-12-10 22:35:45 · answer #3 · answered by alecclews 1 · 0 0

Could be anything. Your going to have to see someone about that, check out CompUsa

2007-12-10 22:34:21 · answer #4 · answered by irreplaceably_rare 3 · 0 0

Its weird.
You have declared main() correctly.
Maybe it requires
int main(int argc, char **argv)
instead

2007-12-11 01:24:02 · answer #5 · answered by Dasher Dude 4 · 0 0

while(a<=length)

Your < will fry you.

2007-12-10 22:35:21 · answer #6 · answered by Stuart 7 · 0 0

fedest.com, questions and answers