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

Exposer Object throws std::bad_alloc exception #621

Open
Christopher-06 opened this issue Dec 1, 2022 · 0 comments
Open

Exposer Object throws std::bad_alloc exception #621

Christopher-06 opened this issue Dec 1, 2022 · 0 comments

Comments

@Christopher-06
Copy link

Hello Together,

I always get an error when I try to create an exposer. My code looks like this:

#include <prometheus/counter.h>
#include <prometheus/exposer.h>
#include <prometheus/registry.h>

int main() {
  using namespace prometheus;

  // create an http server running on port 8080
  Exposer exposer{"127.0.0.1:8080"};
  
  // The rest of the tutorial code was commented out to see what the problem is...

  return 0;
}

The code compiles without problems and only throws this error while it is running:
"Unhandled exception at 0x00007FFB5901CD29 in example.exe: Microsoft C++ exception: std::bad_alloc at location 0x000082F297F770."

My main Cmake file looks like this:

cmake_minimum_required (VERSION 3.8 FATAL_ERROR)
project ("example")

set(CMAKE_CXX_STANDARD 11)

find_package(prometheus-cpp CONFIG REQUIRED) 

add_subdirectory ("example")

Cmake file in example looks like this:

# Add Source and Header Files
file(GLOB PROJECT_SRC *.cpp *.h)
add_executable(${PROJECT_NAME} ${PROJECT_SRC})

target_link_libraries(${PROJECT_NAME} PRIVATE prometheus-cpp::pull)

I have installed this library with anaconda and follewed these instructions here

Can anyone help me? Thanks in advance!

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

1 participant