Author | Topic |

Location: ballarat
Registered: April 2003
|
anyone have much experience with c?
|
Fri, 11 June 2004 05:46
|
 |
a call to comp nerds
i have a function in one file (it has no header file) and another function in a different file that i want to call the first function.
i have tried making the second function extern but no luck, always getting an 'undeclared identifier' complier error.
i have mainly worked with c++, so lonely functions that are not attached to an object i am a little unfamilar with.
any help?
cheers
ehendrikd
|
|
|

Location: South Australia
Registered: July 2002
|
Re: anyone have much experience with c?
|
Fri, 11 June 2004 15:37

|
 |
Are you using a makefile or not?
Your best bet is to have somewhere in the file that calls the first function (function prototype) try a line like this ->
extern type nameoffunc(blah, blah, blah);
you should be able to use that function anywhere within that file.
then when you link the thing, make sure you have something like
gcc -c firstfile.c
gcc -c filethatcallsfirstfile.c
gcc -o firstfile.o filethatcallsfirstfile.o
geddit?
|
|
|

Location: Wahroonga
Registered: June 2003
|
Re: anyone have much experience with c?
|
Fri, 11 June 2004 22:35

|
 |
Bringing back bad memories...... no .......must get out of here.
|
|
|

Location: South Australia
Registered: July 2002
|
Re: anyone have much experience with c?
|
Sat, 12 June 2004 00:26

|
 |
lol - seriously what's wrong with C? Are you an 'object oriented' code-monkey or something Or you just left the whole programming thing when you realised it was a totally frustrating exercise in human torture?
|
|
|

Location: ballarat
Registered: April 2003
|
Re: anyone have much experience with c?
|
Mon, 14 June 2004 23:47

|
 |
thanks for the replies guys 
the situation is i am intergrating a f2c (fortran to c) generated c function into a vc++ 6.0 dll. i have everything compiling except that it cant find the c function that is in its own file. i have tried using a header file that contains the function prototype but no luck. i have made a test dll where the lone c function can be found, so i think the problem is perhaps in the order that it links.
joy joy joy 
cheers
|
|
|

Location: South Australia
Registered: July 2002
|
Re: anyone have much experience with c?
|
Tue, 15 June 2004 02:08

|
 |
Quote: | i have everything compiling except that it cant find the c function that is in its own file
| That just sounds evil! If you put a prototype at the very top of the file (yeah most people use header files but you don't have to) then this shouldn't happen!
|
|
|

Location: Canberra
Registered: August 2003
|
Re: anyone have much experience with c?
|
Tue, 15 June 2004 02:27
|
 |
create a shell object with one method?
|
|
|