pbPlots
pbPlots copied to clipboard
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped)
Hello,
I am using pbplots as per the tutorial: https://github.com/InductiveComputerScience/pbPlots/blob/master/Cpp/example1.cpp For this new version.
The first error I get is :
error: ‘FreeAllocations’ was not declared in this scope
FreeAllocations();
If I comment it out, I get the error:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
This is my CMake file:
cmake_minimum_required(VERSION 3.0.2)
project(Canoo)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
#SET( EIGEN3_INCLUDE_DIR "$ENV{EIGEN3_INCLUDE_DIR}" )
#SET( CMAKE_MODULE_PATH "$ENV{EIGEN3_DIR}" )
find_package(Eigen3 REQUIRED )
link_directories(${Eigen_INCLUDE_DIRS})
# include_directories is needed for the compiler to know where looking for Eigen3 header files to be included
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/pbplots" )
add_executable(solution main.cpp pbplots/pbPlots.cpp pbplots/supportLib.cpp)
#target_link_libraries(solution eigen)
I kept all the pbplots cpp and hpp in pbplots folder in my current directory. I have no trouble in completion. But execution is trouble.
Whats the problem? though I am following exactly in the tutorial.
Hi! The YouTube tutorial is for an older version of the library. Be sure to select the same version as in the tutorial to follow it. You can also use the newest version of the library, but then use the newest version of the example as well.
Hi Martin, Thanks for responding. You have misunderstood. I am using the newest version of pbplots. The above is from the newest version and the examples and cpp files are from the new version, but still, I am having trouble?
Could you paste all your source files? You have this in you make file, for example: main.cpp