Results 1 to 4 of 4

Thread: error: undefined reference to 'main'. when compiling my C++ code in Code::Blocks ID

  1. #1
    Join Date
    May 2013
    Beans
    51

    error: undefined reference to 'main'. when compiling my C++ code in Code::Blocks ID

    Hi,

    I am new to use Code::Blocks IDE.
    I created a new project with console Application.
    Then I created a new Class with corresponding .h file(for example say Display.h) and added it in my project.
    Then I added the Display.h file in the main.cpp file.
    And now I am trying to build the project. It is showing error: undefined reference to 'main'.

    Please help me. what shall I do?

    Regards,

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: error: undefined reference to 'main'. when compiling my C++ code in Code::Block

    So... do you have a main() function in your code?

  3. #3
    Join Date
    May 2013
    Beans
    51

    Re: error: undefined reference to 'main'. when compiling my C++ code in Code::Block

    yes... main function is there in my code.

  4. #4
    Join Date
    Apr 2012
    Beans
    7,256

    Re: error: undefined reference to 'main'. when compiling my C++ code in Code::Block

    Sorry I don't know what else to suggest without seeing your code + exactly how you are trying to build it

    IDEs sometimes make complicated things simple - but often make simple things complicated

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •