CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2013
    Posts
    2

    fatal error LNK1120

    I can not figure out the error codes from this program.

    #include <stdio.h>
    #define NUMS 7 /* establishes NUMCOLS as 5 */

    int main()
    { /* start of main */
    void display(int channels [NUMS]); /* function prototype */

    int channels[NUMS] = {2,4,5,7,9,11,13};/* declares array channels to have 7 numbers which are initialized to 2,4,5,7,9,11,13 */

    display(&channels [NUMS]);

    return 0;
    }

    void display(int * channels [NUMS])
    {
    extern int i;
    printf("\n%d %d %d %d %d %d %d", &channels);
    }


    I receive this message after building:

    1>------ Build started: Project: WA 4 B 1 Christopher Caron, Configuration: Debug Win32 ------
    1> WA 4 B 1 Christopher Caron.cpp
    1>WA 4 B 1 Christopher Caron.obj : error LNK2019: unresolved external symbol "void __cdecl display(int * const)" (?display@@YAXQAH@Z) referenced in function _main
    1>C:\Users\Chris\Documents\Visual Studio 2010\Projects\WA 4 B 2 Christopher Caron\Debug\WA 4 B 1 Christopher Caron.exe : fatal error LNK1120: 1 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Any help would be awesome.

  2. #2
    Join Date
    May 2007
    Posts
    811

    Re: fatal error LNK1120

    You have this:
    Code:
    void display(int channels [NUMS]); /* function prototype */
    and:
    Code:
    void display(int * channels [NUMS])
    See the difference?

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured