Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 2nd, 2005, 9:40 PM   #1
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
troublesome c problem

okay im using dev-C++ with the gcc compiler and when i have a prototype like this:

void LoadVariable(char *);

and here's the code for that function:

void LoadVariable(char *Name) /* Load a Variable to the Primary */
{   
    char a_string[30];		/* Register */
    strcpy(a_string, "mov  ax, ");
    strcat(a_string, Name);
    EmitLn(a_string);
}

(yeah EmitLn() is a function and i #included'ed <string.h> so that's fine). but when i try to compile dev-C++ says "Conflicting types for LoadVariable()" and says it's on the line for its prototype. and then it says "previous implicit declaration of LoadVariable() was here" for the line where i try to call it.

can anybody help???
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote
Old Jul 2nd, 2005, 9:47 PM   #2
EverLearning
Hobbyist Programmer
 
EverLearning's Avatar
 
Join Date: May 2005
Location: Indiana
Posts: 130
Rep Power: 4 EverLearning is on a distinguished road
How do you call the function? from where-ever it is you need to call it.
It seems like you may be calling it "wrong" according to the prototype, i.e. it is argument mismatch and the debugger points you back to the prototype.
__________________
got math? yumm...

"All men by nature desire to know" -Aristotle, Metaphysics
EverLearning is offline   Reply With Quote
Old Jul 2nd, 2005, 10:09 PM   #3
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
It sounds like the compiler is seeing the prototype after the code where the function is called. For example;

int main()
{
    char *something[] = whatever();
    LoadVariable(something);
}

void LoadVariable(char *);
In this case, the LoadVariable seen by main() is actually an implicit declaration of a function that returns int. That implicit declaration is different from the subsequent actual declaration, hence the complaint from the compiler.

You might also see something similar if you attempt to pass arguments of different type than char * to LoadVariable(). For example, if you pass a const char * .....
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:43 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC