compilation error

This is a discussion on compilation error within the C++ Programming forums, part of the General Programming Boards category; i have two file. file1.cpp Code: #include<stdio.h> void func(int A[]); int main() { int A[20]; A[0]=123; A[1]=456; func(A); printf(" %d",A[2]); ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    92

    Lightbulb compilation error

    i have two file.



    file1.cpp

    Code:
    #include<stdio.h> 
    
    void func(int A[]); 
    
    int main() 
    
    { 
          
         int A[20]; 
          
         A[0]=123; 
          
         A[1]=456; 
          
         func(A); 
          
         printf(" %d",A[2]); 
          
         return 0; 
          
    }
    file2.cpp

    //here is the body of the function

    Code:
     void func(int A[]) 
    
    {   A[2] = A[0] + A[1]; 
    
     printf(" hello "); //here i am getting error !!!!!! 
    
    }
    then i did " add files to the project " and " rebuild all " to compile and run in VC++ ...... but i am getting " file2.cpp printf' : undeclared identifier " error.

    but i need to print some variable etc inside that function . how can i print something(e.g value of variable etc) inside that function ???
    thanks...

    blue_gene

  2. #2
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161
    This was answered on the other forum you posted this question.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21