d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Extern Function C
Add Reply New Topic New Poll
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Oct 22 2012 12:56pm
Say an int calculator defined below is external to a calculator function:

Code

Located in expression.c

int add_six(int* number){
 number += 22;
}

Located in calculator.c

int random_method(int c){
extern int i; //I want to send c into add_six but add_six is an external funcation...?

}


some how call external function so that the number calculated is i and that value is returned?
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Oct 22 2012 02:17pm
Actaully jsut put the method inside my program, and I'm getting an implicit delcaration error.



I'm calling:
token is defined as a const char *token

Code
int i = this_funcion(token);

unsigned int this_function(const char *str){

some stuff

}

Not sure why I'm getting an error...?

Exact message

error: conflicting types for this_function (line 175)

note: previous implicit declaration of 'hash_code' was here (Line 53)

This post was edited by lopelurag on Oct 22 2012 02:19pm
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Oct 22 2012 03:55pm
Got it
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Oct 22 2012 05:46pm
Got another question about a makeflle

Here's the command I use and the code:



Not sure why the error is coming up.
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Oct 22 2012 08:26pm
Nvm think I finaly got it

This post was edited by lopelurag on Oct 22 2012 08:41pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll