Please support our C++ advertiser: Programming Forums
Views: 7023 | Replies: 44
![]() |
•
•
Join Date: Mar 2006
Posts: 25
Reputation:
Rep Power: 3
Solved Threads: 0
Hello everybody!
I would like to know "how to link header file (.h file ) and source file (.c file ) in c.
I have downloaded many .h files and .c files. I have noticed that the functions are declared in .h files and denined in .c files. I don't know how to link them in main program.
Please explain me.
thanks in advance,
Moe
I would like to know "how to link header file (.h file ) and source file (.c file ) in c.
I have downloaded many .h files and .c files. I have noticed that the functions are declared in .h files and denined in .c files. I don't know how to link them in main program.
Please explain me.
thanks in advance,
Moe
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,642
Reputation:
Rep Power: 40
Solved Threads: 986
.h files are includes in .c files
Then run your compiler against all the *.c files. It will create *.obj files which can be used by the linker to create the executable file.
Beyone that, how to do all the above depends on the compiler and operating system you are using.
// myfile.c // #include "myheader.h" // rest of c program here
Then run your compiler against all the *.c files. It will create *.obj files which can be used by the linker to create the executable file.
Beyone that, how to do all the above depends on the compiler and operating system you are using.
•
•
Join Date: Mar 2006
Posts: 25
Reputation:
Rep Power: 3
Solved Threads: 0
•
•
•
•
Originally Posted by Ancient Dragon
.h files are includes in .c files
// myfile.c // #include "myheader.h" // rest of c program here
Then run your compiler against all the *.c files. It will create *.obj files which can be used by the linker to create the executable file.
Beyone that, how to do all the above depends on the compiler and operating system you are using.
When I compile *.c files, most of them have many errors.
So I think I can not create obj file.
I have downloaded that for link grammar api.
http://www.link.cs.cmu.edu/link
I think that can not have error.Can you please test that for me.
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,642
Reputation:
Rep Power: 40
Solved Threads: 986
What compiler are you using? If you use Microsoft Visual C++ 2005 Express, the download includes project files.
If that is your compiler, then the compiler will spew out a whole bunch of warnings about using deprecated C functions. you can disable the warning with a pragma. put this at the top of link-includes.h. Otherwise everyting compiled and linked ok for me using VC Express compiler.
If that is your compiler, then the compiler will spew out a whole bunch of warnings about using deprecated C functions. you can disable the warning with a pragma. put this at the top of link-includes.h. Otherwise everyting compiled and linked ok for me using VC Express compiler.
#pragma warning(disable: 4996)
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,642
Reputation:
Rep Power: 40
Solved Threads: 986
•
•
•
•
Originally Posted by Moe
Don't laugh at me.
I am using turbo c compiler. It is an ancient software.
I also try to use Borland 5.5. But that gives many error when I compile .c file.
:cheesy: :cheesy: :cheesy: :cheesy: :cheesy: :cheesy: :cheesy:
trash those old ancient compilers! you can get pretty good free compilers, such as the Express I mentioned previously or Dev-C++ from www.bloodshed.net.
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,642
Reputation:
Rep Power: 40
Solved Threads: 986
•
•
•
•
Originally Posted by Moe
You are also ancient dragon.
Are you good?
It is just joke.
Please guide me.
Sorry -- I couldn't resist the laughter.
you cannot use TC because it is too old and does not know about long file names -- file names that are longer than 8 characters followed by a perios and 3 characters for the extension. That is the ancient MS-DOS format. The files in the download you are trying to compile have long filenames.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode