ben-strasser / fast-cpp-csv-parser

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

Example code does not run when compiled with CMake #20

Closed albertchan closed 8 years ago

albertchan commented 8 years ago

I've tried compiling the example code from the readme using CMake but I keep getting the following error:

libc++abi.dylib: terminating with uncaught exception of type io::error::can_not_open_file: Can not open file "ram.csv" because "No such file or directory".

I've place a dummy CSV file named ram.csv in the same path as main.cpp and the included csv.h. The file also contains the appropriate columns and dummy data to match the example. My CMakeLists.txt is simply:

cmake_minimum_required(VERSION 3.3)
project(csv_example)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(csv_example ${SOURCE_FILES})

Any ideas on what I'm doing wrong? Thanks.

ben-strasser commented 8 years ago

I have no experience with CMake. My tip would be that the current working directory is not the same directory where main.cpp resides. Anyway this does not look like an issue with the CSV parser but with CMake.