In function `main':
run.cpp:(.text+0x5): undefined reference to `test_default_1()'
collect2: error: ld returned 1 exit status
make[2]: *** [run] Error 1
#include <iostream>
#include <string>
void test_default_1();
struct Regular_type
{
Regular_type()
{
// TODO: Modify this as required by the instructions.
std::string s1 = "default ctor";
std::cout << this << std::endl;
}
~Regular_type()
{
// TODO: Modify this as required by the instructions.
std::string s2 = "dtor";
std::cout << s2 << this << std::endl;
}
void f()
{
// TODO: Modify this as required by the instructions.
std::string s3 = "member";
std::cout << s3 << this << std::endl;
}
void test_default_1()
{
Regular_type a;
Regular_type b;
}
};
int
main()
{
test_default_1(); //calling the first function as requested
}
okay so now i'm getting this error, changed a few things, 49:16: error: ‘test_default_1’ was not declared in this scope
test_default_1(); //calling the first function as requested
#include <iostream>
#include <string>
//void test_default_1(string, string, string);
struct Regular_type
{
Regular_type()
{
// TODO: Modify this as required by the instructions.
std::string s1 = "default ctor";
std::cout << this << std::endl;
}
~Regular_type()
{
// TODO: Modify this as required by the instructions.
std::string s2 = "dtor";
std::cout << s2 << this << std::endl;
}
void f()
{
// TODO: Modify this as required by the instructions.
std::string s3 = "member";
std::cout << s3 << this << std::endl;
}
void test_default_1()
{
Regular_type a;
Regular_type b;
}
};
int
main()
{
test_default_1(); //calling the first function as requested
}