i'm having a strange problem where i get undefined reference to "PDC_ungetch"
while I can use without any problem other functions from curses.h, for example:
#include <curses.h>
int main(){
initscr();
int ch = getch();
ungetch(ch);
return 0;
}
With this code i only get undefined reference to "PDC_ungetch"
while initscr()
works with no problems, what would be the problem?
My CMake is the following:
cmake_minimum_required(VERSION 3.3)
project(rogue)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
set(SOURCE_FILES main.c gamelib.c gamelib.h maze.c maze.h) //these are other files I use
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
add_executable(rogue ${SOURCE_FILES} gamelib.c gamelib.h maze.c maze.h) //Same here
target_link_libraries(rogue ${CURSES_LIBRARIES})
Thanks in advance for the help.
If you look at the header file <curses.h>
from PDCurses, that particular function is the only one treated in that way: defining a macro to use the function with a PDC_
prefix.
If you happen to be cross-compiling (from Cygwin for example), and if the cmake
macros are not setup/used properly, they could find the system curses library, which does not use that naming convention. In that case, you would get just that one error when trying to link.