これが私が使っているコードです。new_flight
空の宣言以外のコードが現在ないこの関数にすべての入力を渡せるようにしたいと思います。参照によってトークンを渡そうとしていますが*
&
、値だけでトークンを渡そうとしましたが、どれも機能していないようです。
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
void new_flight( vector<string> &tokens );
int main( int argc, char *argv[] )
{
vector<string> tokens;
cout << "Reservations >> ";
getline(cin, input);
istringstream iss( input );
copy(istream_iterator<string>( iss ),
istream_iterator<string>(),
back_inserter<vector<string> > ( tokens ));
new_flight( tokens );
}
これがコンパイラが私に言っていることです
Undefined symbols for architecture x86_64:
"new_flight(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)", referenced from:
_main in ccplPBEo.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
また、実際にトークンをnew_flightに渡す行をコメントアウトすると、正常new_flight( tokens )
にコンパイルされます。
ご覧いただきありがとうございます