Hello! I recently switched from doing development in WSL on a Windows machine to developing on a Mac. I have a simple project that uses SNMP++ for simple gets and sets which worked flawlessly in WSL but is giving me trouble on my Mac. Here’s what I’ve done:
Downloaded the SNMP++ 3.4.8 archive and extracted it
In the resulting folder, ran:
autoreconf -i
./configure
make
sudo make install
The first time I tried this I got some errors on the autoreconf that that I was using too new of an autoconf version, so I used brew to install and link the required version (2.69). Once I had autoconf version 2.69, I was able to run the installation steps without errors.
My issue now is that in my project, CMake finds SNMP++ and successfully generates build files, but when I run make it is unable to find them. More specifically, this is my CMakeLists:
cmake_minimum_required(VERSION 3.10)
project(abc)set(CMAKE_C_COMPILER /usr/bin/cc)
set(CMAKE_CXX_FLAGS “-O3 -Wall -Wextra -Werror -pthread”)set(CMAKE_CXX_STANDARD 17)
add_executable(tester
tests/test_main.cpp
src/a.cpp
src/b.cpp
src/c.cpp)
target_include_directories(tester PRIVATE include)add_executable(tester2
tests/tester2.cpp
src/b.cpp
src/c.cpp)
target_include_directories(tester2 PRIVATE include)find_library(SNMP_PP snmp++)
if(SNMP_PP)
add_definitions(-DSNMP_PP)
target_link_libraries(tester PUBLIC snmp++)
target_link_libraries(tester2 PUBLIC snmp++)
message(STATUS “SNMP++ FOUND ${SNMP_PP}”)
endif()
This finds CMake, and prints "SNMP++ FOUND /usr/local/lib/libsnmp++.dylib
When I run make, however, I get this:
make
Consolidate compiler generated dependencies of target tester
[ 11%] Building CXX object CMakeFiles/tester.dir/src/HardwareManager.cpp.o
tester2.cpp:9:10: fatal error: ‘snmp_pp/snmp_pp.h’ file not found
#include <snmp_pp/snmp_pp.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/tester.dir/src/tester2.cpp.o] Error 1
make[1]: *** [CMakeFiles/tester.dir/all] Error 2
make: *** [all] Error 2
Any ideas what could be going wrong? Thanks!