使用 Visual Studio 2010 的 pdcurses 链接 [英] pdcurses linkage using Visual Studio 2010

查看:32
本文介绍了使用 Visual Studio 2010 的 pdcurses 链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我很不爽.我只是想包括 pdcurses(即 Windows 的 ncurses)进入测试程序.链接虽然失败了.

This is doing my nut in. I'm just trying to include pdcurses (i.e. ncurses for windows) into a test program. Linkage though is failing.

使用 Visual Studio 2010.

Using Visual Studio 2010.

我完全知道设置正确的链接附加库路径并列出库本身.没有快乐.

I'm fully aware of setting up the correct link additional libraries path and to list the libraries themselves. No joy.

我在 pdcurses 网站上尝试了各种预构建.没有这样的运气.

I've tried the various pre-builts on the pdcurses website. No such luck.

我当然求助于从源代码构建.按照规定从 Visual Studio 命令提示符使用 nmake.建好了.纳达在链接上.

I of course resorted to building from source. Using nmake from the Visual Studio command prompt as prescribed. Built ok. Nada on link.

我错过了什么.周五可能太晚了...

What am I missing. It's maybe just too late on Friday...

输出如下:

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

推荐答案

好的.我觉得比较傻.这是后代的解决方案...

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

分布式 pdcurses 二进制文件是 32 位.我试图为64位构建.

The distributed pdcurses binaries are 32bit. I was trying to build for 64bit.

从根本上说,我忘记了链接的第一条规则:不要混搭架构.

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

更具体地说,当尝试从源代码构建时:

More specifically, when attempting to then build from source:

1) 小心启动错误的 Visual Studio 命令提示符.工具"菜单中的默认选项是 x86 选项.如果您只是尝试运行 cl.exe,您就会发现这一点.

1) beware of starting the wrong Visual Studio command prompt. The default one from the Tools menu is the x86 one. If you just try and run cl.exe you'll find this out.

改为从开始菜单运行提示:Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio x64 Win64 Command Prompt (2010)

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

调用构建,然后通过 cd 进入 pdcurses 目录/win32a 并键入:

Invoke the build then by cd'ing to pdcurses directory/win32a and typing:

nmake -f vcwin32.mak DLL=pdcurses.dll

另外,2) 在编译 pdcurses 之前更改 pdcurses Windows 生成文件 (vcwin32.mak) 的第 111 行:

Also, 2) before you compile pdcurse change line 111 of the pdcurses Windows makefile (vcwin32.mak):

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

(注意:即 X64 架构!)

(NOTE: i.e. X64 architecture!)

现在一切都是一致的.将构建 pdcurses 库.它将与我在 x64 上构建的测试应用程序链接(如原始输出所示).

Everything is now consistent. The pdcurses library will build. And it will link with my test app which (as the original output shows) I am building on x64.

这篇关于使用 Visual Studio 2010 的 pdcurses 链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆