Why do I get unresolved external errors?
Hello,
When compiling I get output about unresolved externals? I am not sure what is wrong with my code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include <iostream>
using namespace std;
struct nums
{
int number;
nums *ptr_to_next_num;
};
void display_integer(nums *);
int main()
{
nums int1 = { 1 };
nums int2 = { 2 };
nums int3 = { 3 };
nums int4 = { 4 };
nums int5 = { 5 };
nums *first;
first = &int1;
int1.ptr_to_next_num = &int2;
int2.ptr_to_next_num = &int3;
int3.ptr_to_next_num = &int4;
int4.ptr_to_next_num = &int5;
int5.ptr_to_next_num = NULL;
display_integer(first);
return 0;
}
void display_integers(nums *integer_set)
{
while (integer_set != NULL)
{
cout << integer_set->number << endl;
integer_set->ptr_to_next_num;
}
return;
}
|
Output
1>------ Build started: Project: Exercise13.4_2, Configuration: Debug Win32 ------
1>Exercise13.4_2.cpp
1>Exercise13.4_2.obj : error LNK2019: unresolved external symbol "void __cdecl display_integer(struct nums *)" (?display_integer@@YAXPAUnums@@@Z) referenced in function _main
1>C:\Users\Kish\Documents\Visual Studio 2017\Projects\Exercise13.4_2\Debug\Exercise13.4_2.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "Exercise13.4_2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
display_integer
display_integers
Spot the difference,
DOH! I am just going to flay myself
Topic archived. No new replies allowed.