1 / 1

Multiple File Compilation and Linking

Multiple File Compilation and Linking . pthread.h. stdio.h. mars.h. venus.h. #ifndef STDIO_H #define STDIO_H #endif. #ifndef PTHREAD_H #define PTHREAD_H #endif. #ifndef MARS_HEADER #define MARS_HEADER #define MIN 1000 int doA(int nbr); #endif. #ifndef VENUS_HEADER

agostino
Télécharger la présentation

Multiple File Compilation and Linking

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multiple File Compilation and Linking pthread.h stdio.h mars.h venus.h #ifndef STDIO_H #define STDIO_H #endif #ifndef PTHREAD_H #define PTHREAD_H #endif #ifndef MARS_HEADER #define MARS_HEADER #define MIN 1000 int doA(int nbr); #endif #ifndef VENUS_HEADER #define VENUS_HEADER typedef struct { // fields } gravityType; void doB(char symbol); #endif programX.c #include <stdio.h> #include <pthread.h> #include “mars.h” #include “venus.h” main()‏ { gravityType value; pthread_t threadID; int result; printf(“Hello”); result = doA(5); doB(‘d’); } // End main mars.c venus.c #include <stdio.h> #include “mars.h” int doA(int nbr)‏ { return nbr * nbr; } // End doA #include “venus.h” #include <pthread.h> #define MAX 100 void doB(char symbol)‏ { pthread_t threads[MAX]; } // End doB programX.o libc.a libpthread.a mars.o venus.o Object code file The Standard C Library Threads library Object code file Object code file a.out gcc programX.c mars.c venus.c Executable File

More Related