| | |
How to link .c file and .h file
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2006
Posts: 36
Reputation:
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
.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.
C++ Syntax (Toggle Plain Text)
// 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: 36
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Ancient Dragon
.h files are includes in .c files
C++ Syntax (Toggle Plain Text)
// 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.
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.
C++ Syntax (Toggle Plain Text)
#pragma warning(disable: 4996)
•
•
•
•
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.
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.
•
•
•
•
Originally Posted by Moe
You are also ancient dragon.
Are you good?
It is just joke.
Please guide me.
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.
![]() |
Similar Threads
- save ram file to hard disk,how? (Graphics and Multimedia)
- highjackthis log file... do help me (Viruses, Spyware and other Nasties)
- Highjack file Ie wont download (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Monetary / Compound Interest
- Next Thread: Help with Homework c++ (constructors)
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






