简体   繁体   中英

Compiling for windows 64bit target, issues with static .libs

I'm using MS Visual Studio 2008 professional edition on windows 7 64bit. I installed the 64 bit compilers along with the standard 32bit ones.

I have used http://argtable.sourceforge.net/ for windows 32bit programs before

I have no problems building my application (Which is just written in plain and simple C89) to use argtable2.lib for a win32 target, though when I set the "Active solution platform" to "x64", I get a bunch of errors during the linking stage regarding unresolved external symbols.

error LNK2019: unresolved external symbol arg_lit0 referenced in function main error LNK2019: unresolved external symbol arg_strn referenced in function main error LNK2019: unresolved external symbol arg_end referenced in function main ...

ending with " fatal error LNK1120: 9 unresolved externals".

I spotted some options such as the linker option "/MACHINE:X64", but I dont know how to use this or whether I should even be touching that option.

I think I need to do something involving building a 64bit capable version of argtable2.lib, but I dont know how to do this. Any ideas?

.lib giles are not agnostic- 32 and 64 bit lib files are separate. so you need to build a 64 bit version (not 64 bit capable) of argtable2.lib.

I found the solution myself, going to let everyone else know if anyone gets the same issue. Instead of using nmake to create the static lib, I made a new vc++ 2008 project, added all the necessary argtable .c's and .h's, set the type of project to Static Lib, and compiled. Worked fine set to 64bit with linker set to /MACHINE:X64. Now my application is fully 64bit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM