[CMake] How to include Portaudio to my project?

Carlton Banks noflaco at gmail.com
Mon Oct 23 08:30:04 EDT 2017


also posted on SO: https://stackoverflow.com/questions/46886033/paerror-not-a-class-or-namespace <https://stackoverflow.com/questions/46886033/paerror-not-a-class-or-namespace>

I seem to have some problems including portaudio to my project, I guess my error is caused be me not including portaudio accurately to my project. 


My project source tree looks like this

audio$ tree
.
├── audio.cbp
├── CMakeCache.txt
├── CMakeFiles
│   ├── 3.2.2
│   │   ├── CMakeCCompiler.cmake
│   │   ├── CMakeCXXCompiler.cmake
│   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   ├── CMakeSystem.cmake
│   │   ├── CompilerIdC
│   │   │   ├── a.out
│   │   │   └── CMakeCCompilerId.c
│   │   └── CompilerIdCXX
│   │       ├── a.out
│   │       └── CMakeCXXCompilerId.cpp
│   ├── audio.dir
│   │   ├── build.make
│   │   ├── cmake_clean.cmake
│   │   ├── CXX.includecache
│   │   ├── DependInfo.cmake
│   │   ├── depend.internal
│   │   ├── depend.make
│   │   ├── flags.make
│   │   ├── link.txt
│   │   └── progress.make
│   ├── cmake.check_cache
│   ├── CMakeDirectoryInformation.cmake
│   ├── CMakeOutput.log
│   ├── CMakeTmp
│   ├── feature_tests.bin
│   ├── feature_tests.c
│   ├── feature_tests.cxx
│   ├── Makefile2
│   ├── Makefile.cmake
│   ├── progress.marks
│   └── TargetDirectories.txt
├── cmake_install.cmake
├── CMakeLists.txt
├── CMakeLists.txt.user
├── database.cpp
├── database.h
├── main.cpp
├── Makefile
├── match.cpp
├── match.h
├── portaudio
│   ├── libportaudio.a
│   └── portaudio.h
├── record.cpp
├── record.h
├── spectogram.cpp
└── spectogram.h

7 directories, 45 files
In which I have, as suggested by the portaudio guide,  copy pasted the libportaudio.a and portaudio.h into my project folder. 


My cmakelist looks like this

project(audio)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})

So it should include all the files.. 


but defining a function as such

void record::example()
{
    std::cout << "In example!" << std::endl;
    std::cout << Pa_GetVersion() << std::endl;
}


Is not possible.. , I get an compile error stating that undefined reference to Pa_GetVersion().. 
As if it doesn’t know the existence of this. How do i fix that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171023/9f29e9a7/attachment-0001.html>


More information about the CMake mailing list