Thread: error LNK1120: 1 unresolved externals

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    102

    error LNK1120: 1 unresolved externals

    I try to run the following code which actually from a book ( C How to program by P.J.Deitel & H.M. Deitel) regarding arrays chapter.

    Code:
    #include <stdio.h>
    
    int main ( void )
    {
    	int n[ 10 ];
    	int i;
    
    	for ( i = 0; i < 10; i++) {
    		n[ i ] = 0;
    	}
    
    	printf("%s%13s\n", "Element", "Value");
    
    	for ( i = 0; i < 10; i++ ) {
    		printf("%7d13d\n", i, n[ i ] );
    	}
    	getchar();
    	return 0;
    }
    But when I try to run it, it will always produce 2 of the following errors.
    1. error LNK2019: unresolved external symbol_WinMain@16 referenced in function____tmainCRTStartup
    2. error LNK1120: 1 unresolved externals

    Any idea?

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    You set your program up as a windows project. For project type you need to select console.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    102
    Oh.It's just a stupid mistake i make. Thank you so much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fatal error LNK1120: 2 unresolved externals
    By SgtPooki in forum C++ Programming
    Replies: 10
    Last Post: 08-09-2010, 07:28 AM
  2. Fatal Error LNK1220: 1 unresolved externals
    By zenghoong in forum C Programming
    Replies: 3
    Last Post: 10-12-2009, 03:24 AM
  3. unresolved externals??
    By pokiepo in forum C Programming
    Replies: 6
    Last Post: 07-02-2008, 11:38 AM
  4. unresolved externals
    By drater in forum C Programming
    Replies: 4
    Last Post: 03-13-2008, 08:49 AM
  5. unresolved externals?!?!
    By rainman39393 in forum C++ Programming
    Replies: 5
    Last Post: 02-28-2008, 06:27 AM