all, I am an absoluty newbie of c/c++. When I compile my main.cpp in ubuntu command line: g++ main.cpp, coming with following error:
main.cpp:(.text+0xa8):for‘mesh(std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’undefined reference collect2: error: ld returned 1 exit status
All my codes are:
main.cpp
#include <iostream>
#include <sstream>
#include <vector>
#include "mesh.h"
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
std::cout<< argc << std::endl;
argv[0] = "main" argv[1] = "buffer.obj"
std::cout<< argv[1] << std::endl;
std::string filename = "map.obj";
mesh(filename);
return 0;
}
mesh.h
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
void mesh(std::string filename);
mesh.cpp
#include "mesh.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
void mesh(std::string filename){
std::cout << filename << std::endl;
}