ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.11k stars 440 forks source link

error: ‘in’ does not name a type #61

Closed chengjiehuang closed 6 years ago

chengjiehuang commented 6 years ago

Hi Ben Strasser,

I really love your code, but when I try to complie the sample code in the section: https://github.com/ben-strasser/fast-cpp-csv-parser#getting-started I got an error: 'in' does not name a type.

# include "csv.h" int main() { io::CSVReader<3> in("ram.csv"); // no error here. in.read_header(io::ignore_extra_column, "vendor", "size", "speed"); // error: 'in' does not name a type. std::string vendor; int size; double speed; while(in.read_row(vendor, size, speed)) { // do stuff with the data } }

It's weird... Could you give me some hint where there is a problem.

Thanks, Chengjie

benslaney commented 5 years ago

Can you say what the solution was? I'm having the same problem when using the example from the front page

tester.cpp:4:3: error: use of undeclared identifier 'io'
  io::CSVReader<3> in("ram.csv");
  ^
tester.cpp:4:20: error: use of undeclared identifier 'in'
  io::CSVReader<3> in("ram.csv");
chengjiehuang commented 5 years ago

Hi Ben, I found that I wrongly put “#include “csv.h”” in a namespace. So I closed this issue.