user2035780
user2035780

Reputation: 63

Visual C fatal error LNK1120: 1 unresolved externals

Don't know whats wrong, all help will be greatly appreciated. I'm thinking I am having a problem with a file source, but am not sure.

1>------ Build started: Project: Assignment 08 ADL, Configuration: Debug Win32 ------
1>Build started 3/18/2013 8:37:38 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\Assignment 08 ADL.unsuccessfulbuild".
1>ClCompile:
1>  Assignment 08 ADL.cpp
1>  Generating Code...
1>  Skipping... (no relevant changes detected)
1>  student.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>Assignment 08 ADL.obj : error LNK2019: unresolved external symbol "long __cdecl    decimals(class std::basic_ostream<char,struct std::char_traits<char> > &,int)" (? decimals@@YAJAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@H@Z) referenced in function "void __cdecl display(class student)" (?display@@YAXVstudent@@@Z)
1>J:\CO 127\Assignment 08 ADL\Debug\Assignment 08 ADL.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:24.82

Upvotes: 5

Views: 41854

Answers (4)

Khan
Khan

Reputation: 149

Make sure the external variable able to access in your current file. For Testing easy way is declare same name local variable for testing your logic working not , later change try to access external variable.

Upvotes: 1

Jay Shenawy
Jay Shenawy

Reputation: 1033

This problem appeared to me when I added .c file instead of .cpp so check the name of the files as well

Upvotes: 1

shf301
shf301

Reputation: 31404

You need to look at the line above LNK1120, the LNK2019 error tells you what is wrong.

Inside of your void display(class student) function you are calling a function named decimals that is not defined anywhere in your source code or in a library.

Upvotes: 5

Maverick
Maverick

Reputation: 101

LNK 2019 error is a linker error which generally means some object is not available to the linker. Try clean rebuilding the project and then try to execute it.

Upvotes: 0

Related Questions