how to combine more than two programs....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cworld
    New Member
    • Jan 2007
    • 15

    how to combine more than two programs....

    i have written a program in C for RPN calculator. In this i have made four function and a main ( ) and stored in same file. But now i have stored each function in a different C file and one header file and want to run it.
    So i am getting some errors. My doubt is that whether i have to run each file before i run Main file OR whether i should make headre file more than one.
    I have stored all file in the same folder. Help me !! or suggest me some reference!!!
    Thankyou
    cworld
  • rajesh6695
    New Member
    • Oct 2006
    • 96

    #2
    Create a project and add all source files and header files..... and run the project

    Comment

    • horace1
      Recognized Expert Top Contributor
      • Nov 2006
      • 1510

      #3
      Originally posted by cworld
      i have written a program in C for RPN calculator. In this i have made four function and a main ( ) and stored in same file. But now i have stored each function in a different C file and one header file and want to run it.
      So i am getting some errors. My doubt is that whether i have to run each file before i run Main file OR whether i should make headre file more than one.
      I have stored all file in the same folder. Help me !! or suggest me some reference!!!
      Thankyou
      cworld
      the simplest way is to put function prototypes for all the functions in your C files in the header and include the header in all the C files. Do you have global variables which are used by functions in different files, if so you declare them extern in the header. have a look at


      which compiler are you using?

      Comment

      • cworld
        New Member
        • Jan 2007
        • 15

        #4
        Originally posted by rajesh6695
        Create a project and add all source files and header files..... and run the project
        thankyou sir
        i will try it now.

        Comment

        • cworld
          New Member
          • Jan 2007
          • 15

          #5
          Originally posted by horace1
          the simplest way is to put function prototypes for all the functions in your C files in the header and include the header in all the C files. Do you have global variables which are used by functions in different files, if so you declare them extern in the header. have a look at


          which compiler are you using?
          Thankyou sir,
          I am using VC++.I will declare the variable in header file as extern variable. It means i need one header file in which i can declare variables then include the header file in each file. So then do i need to compile each program separately other than main file.
          thankyou in advance to clear my doubt once again.
          cworld

          Comment

          • horace1
            Recognized Expert Top Contributor
            • Nov 2006
            • 1510

            #6
            Originally posted by cworld
            Thankyou sir,
            I am using VC++.I will declare the variable in header file as extern variable. It means i need one header file in which i can declare variables then include the header file in each file. So then do i need to compile each program separately other than main file.
            thankyou in advance to clear my doubt once again.
            cworld
            I don't use VC but I assume you have to create a project which contains the C and C++ source file. When you tell the compiler to build the project it should compile all files that are not up to date and link them. Perhaps a VC expert can advidse here?

            Comment

            • cworld
              New Member
              • Jan 2007
              • 15

              #7
              Originally posted by horace1
              I don't use VC but I assume you have to create a project which contains the C and C++ source file. When you tell the compiler to build the project it should compile all files that are not up to date and link them. Perhaps a VC expert can advidse here?
              thanx
              i will check it out.

              Comment

              Working...