Pdcurses library doesn't work

Hi,
a little while ago I figured I'd like to try to use something different than iostream (due to it's many restrictions) to cover input and output for my applications, so I googled a bit and decided to try pdcurses. At first I tried downloading the whole library and while I did manage to compile it (it's my first time adding a library), I couldn't get it to work. So after some more googling I found out that pdc34dllw.zip supposedly contains everything I need and comes precompiled so I downloaded it and set up directories paths for my compiler (I tried doing it in Code::Blocks and Dev C++ IDEs with their default compilers) but trying to run the following code:
1
2
3
4
5
6
7
8
#include <curses.h>

int main()
{
	initscr();
	endwin();
	return 0;
}

still returns the following errors:
undefined reference to `initscr'
undefined reference to `endwin'.

The same thing happened when I used library compiled by me. What's surprising for me is the fact that there are no errors about including the library itself. What am I doing wrong?
"undefined reference" is a linker error. It's telling you that it can't find where the initscr and endwin are being defined. You are obviously not linking the pdcurses library correctly. Have you tried adding -lpdcurses to your linker flags?
Thank you for your reply, that fixed it, but I have one more problem. When running the above program I get error saying that pdcurses.dll is missing. I fixed it by copying pdcurses.dll into the directory containing the program, but I'd like a neater solution if possible.
Putting the .dll files in the same directory is the easiest solution.

You could also put the .dll files in some special system directory ( https://msdn.microsoft.com/en-us/library/7d83bc18.aspx ) but if you plan to share your program with others it might be harder to distribute the files if they are spread all over the place (using an installer could help, I guess).

Another possibility is to statically link the library but that's usually more difficult to get working, and you need to check the library licenses that you are allowed to do it.
Last edited on
I guess I'll stick with dynamic library then. Thanks again.
Topic archived. No new replies allowed.