[英]I need to use the vector class in my main and in my header cpp file … What's the proper protocol?
抱歉。 我對構建更大的程序,將文件鏈接在一起以及所有這些好東西有些陌生。
我的標頭.h文件中的函數聲明中包含std :: vector。 我的標頭.cpp文件中的那些函數實現也使用std :: vector。 根據我的理解,我應該只在頭文件.h文件中使用“ #include”,因為該文件中的所有內容實際上都將在編譯時粘貼到我的頭文件.cpp文件中。 我只是想確保。
我的.cpp文件:
#include "PlagiarismDetector_Header.h"
// implementations of functions defined in PlagiarismDetector_Header.h
PlagiarismDetector_Header.h:
#include <iostream> // std::cout, std::endl
#include <vector> // std::vector
#include <string> // std::string
#include <algorithm> // std::swap
#include <math.h> // sqrt()
#include <set> // std::set
#include <map> // std::map
#include <fstream> // std::ifstream
std::vector<std::vector<std::string> > get_file_sntncs(std::fstream&);
std::vector<std::string> get_sntnc_wrds(const std::string&);
double sntnc_smlrty_qtnt(std::vector<std::string>, std::vector<std::string>);
// All the characters that constitute a word
const char LETTERS_ARR[] = {"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'."};
const std::set<char> LETTERS_SET(LETTERS_ARR, LETTERS_ARR + sizeof(LETTERS_ARR)/sizeof(char));
您完全正確,但請考慮以下方面:
extern
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.