http://www.cprogramming.com/tutorial/initialization-lists-c++.html |
|
|
|
|
|
|
|
|
1> Sops_15.cpp 1> Generating Code... 1> Compiling... 1> Flight.cpp 1> Generating Code... 1>Sops_15.obj : error LNK2019: unresolved external symbol "public: int __thiscall Flight::set(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int)" (?set@Flight@@QAEHHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00HH@Z) referenced in function "void __cdecl runTravel(void)" (?runTravel@@YAXXZ) 1>C:\Users\David Sopshin\Documents\Visual Studio 2010\Projects\Sops_15\Debug\Sops_15.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
|
|
http://www.cplusplus.com/reference/vector/vector/emplace_back/ |
http://en.cppreference.com/w/cpp/container/vector/emplace_back |
I am still getting the same error as above however. |
|
|
Line 14 of your .cpp file is a declaration, not an implementation. Nor is it a member of your class. |
|
|
|
|
|
|
Every time I try to define something, I get errors that it is not a part of the class. I'm not sure why that's not working though. |
|
|
Note: It's not best practice to name your arguments the same as your member variables. As you can see from the above snippet, I had to qualify every member variable with this-> so the compiler could tell the argument name apart from the member name. One common convention is to prefix your member variables with m_ i.e. m_FlightNumber |