Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped) #27

Open
nagarjunvinukonda opened this issue Jul 16, 2023 · 3 comments

Comments

@nagarjunvinukonda
Copy link

nagarjunvinukonda commented Jul 16, 2023

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.

@martinfjohansen
Copy link
Member

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.

@nagarjunvinukonda
Copy link
Author

nagarjunvinukonda commented Jul 19, 2023

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?

@martinfjohansen
Copy link
Member

Could you paste all your source files? You have this in you make file, for example: main.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants