Binding pdcurses with Visual Studio 2010

It makes my halo. I am just trying to include pdcurses (i.e. ncurses for windows) in a test program. Communication does not work.

Using Visual Studio 2010.

I am fully aware of setting up the correct link path for additional libraries and listing the libraries themselves. There is no joy.

I tried various pre-builts on the pdcurses website. There is no such luck.

Of course, I resorted to building from a source. Using nmake from the Visual Studio command prompt as required. Built ok. Nada on the link.

What am I missing. Maybe it's too late on Friday ...

The result is below:

1>------ Build started: Project: test, Configuration: Debug x64 ------ 1>Build started 14/12/2012 16:24:32. 1>InitializeBuildStatus: 1> Touching "x64\Debug\test.unsuccessfulbuild". 1>ClCompile: 1> main.c 1>C:\dep\pdcurses\curses.h(160): warning C4005: 'MOUSE_MOVED' : macro redefinition 1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wincon.h(101) : see previous definition of 'MOUSE_MOVED' 1>main.c(73): warning C4133: 'function' : incompatible types - from 'unsigned short [20]' to 'const char *' 1>ManifestResourceCompile: 1> All outputs are up-to-date. 1>main.obj : error LNK2019: unresolved external symbol endwin referenced in function main 1>main.obj : error LNK2019: unresolved external symbol wgetch referenced in function main 1>main.obj : error LNK2001: unresolved external symbol __imp_stdscr 1>main.obj : error LNK2019: unresolved external symbol refresh referenced in function main 1>main.obj : error LNK2019: unresolved external symbol printw referenced in function main 1>main.obj : error LNK2019: unresolved external symbol initscr referenced in function main 1>C:\proj\test.exe : fatal error LNK1120: 6 unresolved externals 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:01.47 
+4
source share
1 answer

Ok I feel pretty stupid. Here is the solution for posterity ...

The pdcurses distributed binaries are 32 bits. I tried to build for a 64 bit version.

Basically, I forgot the first rule of communication: don't mix and match architectures.

More specifically, when you try to build from a source:

1) beware of running the wrong Visual Studio command line. By default, the x86 menu is used in the Tools menu. If you just try to run cl.exe, you will find this.

Instead, run a prompt from the Start menu: Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio x64 Win64 Command Prompt (2010)

Call assembly using cd'ing in the pdcurses / win32a directory and enter:

 nmake -f vcwin32.mak DLL=pdcurses.dll 

In addition, 2) before compiling line 111 of the pdcurse change in the pdcurses Windows makefile (vcwin32.mak) file:

 cvtres /MACHINE:X64 /NOLOGO /OUT:pdcurses.obj pdcurses.res 

(NOTE: i.e. X64 architecture!)

Now everything is consistent. The pdcurses library will be created. And it will be connected with my test application, which (as the original output shows) I am building on x64.

+4
source

All Articles