Thread: implementation file

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    18

    implementation file

    I make a first file : something.h where I define a class and its functions .
    Then there is the implementation file : something.cpp where I write the code for each function .
    Finally , it is the int main () .
    My problem is with the implementation file which I am unable to compile . Instead there is a message : [linker error] undefined reference to 'WinMain@16' and Id returned 1 exit status .
    When I try to run the int main () file , it doesn't work .
    But if I put the implementation file directly in the first file ( something.h ), it works fine .
    Do you know what's wrong with the implementation file ?

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    You have probably set up a Win32 Application instead of the desired console application for your project.

  3. #3
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    You might make sure you have added the program file, the h and .cpp file to your project.

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    18
    Yes , that was the mistake , I didn't include the .cpp file . I thought the .h was sufficient .
    Thanks .

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by bejiz
    Yes , that was the mistake , I didn't include the .cpp file . I thought the .h was sufficient .
    Thanks .
    When including the .cpp files don't use the #include directive add it too your project.

  6. #6
    Registered User
    Join Date
    Nov 2005
    Posts
    18
    I don't know any other way to include a file than putting a #include ?
    Do you mean to paste the .cpp file for adding it to my project ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM