Error 1 error LNK2019: unresolved external symbol "void __cdecl show(struct stringy const &)" (?show@@YAXABUstringy@@@Z) referenced in function _main F:\c++代码\exercise8.42\exercise8.42\Source.obj exercise8.42
#include<iostream>
#include<cstring>
struct stringy{
char * str;
int ct;
};
void set(stringy & r1, char * a);
void show(const stringy & r1);
;
int main()
{
stringy beany;
char testing[] = "Reality isn't, and show() go there";
set(beany, testing);
show(beany);
return 0;
}
void set(stringy & r1, char *a)
{
int i = 0;
while (a[i] != '\0')
i++;
r1.str = new char;
r1.ct = i;
for (int b = 0; b < i; b++)
r1.str[b] = a[b];
r1.str[i + 1] = '\0';
}
void show(stringy & r1)
{
std::cout << *r1.str;
}
I am just beginning code in c++.