Thread: net beans 7.2 unable to compile c file(some make error)

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    2

    net beans 7.2 unable to compile c file(some make error)

    mkdir -p build/Debug/MinGW-Windows
    rm -f build/Debug/MinGW-Windows/main.o.d
    g++.exe -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
    main.cpp: In function 'int main(int, char**)':
    main.cpp:16:19: error: 'printf' was not declared in this scope
    make: *** [build/Debug/MinGW-Windows/main.o] Error 1
    nbproject/Makefile-Debug.mk:66: recipe for target `build/Debug/MinGW-Windows/main.o' failed




    BUILD FAILED (exit value 2, total time: 1s)

    THIS IS THE ERROR I AM GETTING

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Sounds like you forgot to include stdio.h
    Fact - Beethoven wrote his first symphony in C

  3. #3
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    main.cpp:16:19: error: 'printf' was not declared in this scope

    Sounds like you didn't include stdio.h?

    POST some code next time though, its quite rude to demand an answer to a problem that we didn't get the question for.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Likely you forgot to included the correct header file.

    Edit: I was really slow on posting my reply.

    Tim S.
    Last edited by stahta01; 01-28-2013 at 09:10 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  5. #5
    Registered User
    Join Date
    Jan 2013
    Posts
    2
    #include <cstdlib>


    using namespace std;




    int main(int argc, char** argv) {
    printf("Hello");
    return 0;


    mkdir -p build/Debug/MinGW-Windows
    rm -f build/Debug/MinGW-Windows/main.o.d
    g++.exe -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
    main.cpp: In function 'int main(int, char**)':
    main.cpp:16:19: error: 'printf' was not declared in this scope
    make: *** [build/Debug/MinGW-Windows/main.o] Error 1
    nbproject/Makefile-Debug.mk:66: recipe for target `build/Debug/MinGW-Windows/main.o' failed




    BUILD FAILED (exit value 2, total time: 1s)


    THIS WAS THE CODE ABOVE ........ITS SOME MAKE ERROR I DONT KNOW WHAT IF YOU CAN HELP IT WOULD BE GREAT.......

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Please read the info at this link!! printf - C++ Reference
    What header did you include?
    What does the link say is the correct header?
    Do you now realize they are not the same header?
    Do you realize it is C++ code that you posted?

    Tim S.
    Last edited by stahta01; 01-28-2013 at 09:30 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  7. #7
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    C and C++ are different.
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 12-05-2011, 05:07 PM
  2. libusb: unable to compile
    By nndhawan in forum C Programming
    Replies: 1
    Last Post: 02-17-2011, 10:56 PM
  3. Unable to compile pro C generated C file in cygwin
    By SasDutta in forum C Programming
    Replies: 4
    Last Post: 07-14-2010, 08:49 AM
  4. compile error when make a wchar_t conversion
    By George2 in forum C Programming
    Replies: 2
    Last Post: 11-26-2007, 10:30 AM
  5. (Error message) Fatal: Unable to open file 'C.OBJ'
    By drojen in forum C++ Programming
    Replies: 2
    Last Post: 05-02-2006, 12:05 AM

Tags for this Thread