Migration from IBM VisualAge C++ 3.6.5 to VS 2010 - c++

We're in the process of migrating 32-bit C++ application to 64-bit application (VS 2010). This application was developed 10 years back with IBM VisualAge C++ 3.6.5 for Windows. Since IBM has stopped support of this compiler, we're facing issues while migrating it to VS 2010.
This is mostly because of some missing libraries.
Sample errors:
error LNK2019: unresolved external symbol __uopen referenced in function "int __cdecl allocate_heap_storage_(void)" (?allocate_heap_storage##YAHXZ)
error LNK2019: unresolved external symbol __ucreate referenced in function "int __cdecl allocate_heap_storage_(void)" (?allocate_heap_storage##YAHXZ)
error LNK2019: unresolved external symbol __udestory referenced in function "int __cdecl deallocate_heap_storage_(void)" (?deallocate_heap_storage##YAHXXZ)
error LNK2019: unresolved external symbol __uclose referenced in function "int __cdecl deallocate_heap_storage_(void)" (?deallocate_heap_storage##YAHXXZ)
error LNK2019: unresolved external symbol __umalloc referenced in function "int __cdecl alloc_share_mem_(int,int)" (?alloc_share_mem#YAPAXHH#Z)
The above functions are defined in umalloc.h but we are missing the definitions.
How can we resolve this?

For the errors above, these function "_ucreate",_udestory , _uclose,_umalloc" are not found when linking, I think these functions were in the run time libraries provided by Visual Age. if you can find the lib files of the these run time libraries, you can put them in the input of link, it may pass the compiling phase, but may fail to launch.
One suggestion here is to replace the functions above with windows functions. All the functions above are related with memory allocations.

Related

Problems when trying to add libcurl as a Reference [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 6 years ago.
I'm trying to include libcurl into my C++ Project, therefore i built the .lib file placed it in a folder called "curl/lib" and then i copied the included folder from the curl folder i downloaded into "Curl/" (i got that from a tutorial online...). Then i copied that "curl" folder i created into the directory where my program is located, then i added the curl path to "Additional Include Directories" und "C++/General" and "Linker/General" in my Project Properties. Then i created a piece of code that uses stuff from that uses code from curl.h (i included that). And the codingg looked fine and there were no errors, but then i built my Project and i got a "fatal error LNK1120: 6 unresolved externals" error and a bunch of "LNK 2019"-errors, told me where the unresolved symbols are:
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_cleanup referenced in function "void __cdecl lel(void)" (?lel##YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_strerror referenced in function "void __cdecl lel(void)" (?lel##YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_perform referenced in function "void __cdecl lel(void)" (?lel##YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_setopt referenced in function "void __cdecl lel(void)" (?lel##YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_init referenced in function "void __cdecl lel(void)" (?lel##YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_global_init referenced in function "void __cdecl lel(void)" (?lel##YAXXZ)
anyone knows what i'm missing or how i can fix this, because it's really annoying and stops me from finishing my project! Any help is greatly appreciated!
It sounds like visual studio (windows), but the same thing applies to any compiler. You tell it where to look for a library file, but you didn't tell it to actually use libcurl, so it didn't look for it.
In visual studio, try Linker, Input, Additional Dependencies
add "libcurl.lib" (or whatever the actual name is).

Fix LNK2019: unresolved external symbol with freeglut

Using this manual, I tried to get freeglut OpenGL application to compile on my computer. This means I:
Copied files from freeglut archive to MS program files folder
Specified freeglut.lib in additional dependencies
Set explicitly the freeglut.lib path in libraries folders
But all takes no effect. The C++ header files are found right, but the libraries not - so I get these errors:
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp__glutMainLoop#0 referenced in function _wmain
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp__glutSpecialFunc#4 referenced in function _wmain
1>OpenglTest.obj : error LNK2019: unresolved external symbol "void __cdecl specialKeys(int,int,int)" (?specialKeys##YAXHHH#Z) referenced in function _wmain
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp__glutDisplayFunc#4 referenced in function _wmain
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp__glutInitDisplayMode#4 referenced in function _wmain
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp____glutInitWithExit#12 referenced in function _glutInit_ATEXIT_HACK#8
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp____glutCreateWindowWithExit#8 referenced in function _glutCreateWindow_ATEXIT_HACK#4
1>OpenglTest.obj : error LNK2019: unresolved external symbol __imp__glutSwapBuffers#0 referenced in function "void __cdecl display(void)" (?display##YAXXZ)
So my questions:
Could you guess what may be wrong? (not easy, but I cannot find this out obviously)
Is there some other manual google didn't find, but better than the one I used?
Is there some other archive I should download?
My C++ code comes from here. All functions are well found in freeglut header files. Just the libraries are missing.
This seems like a C vs C++ linkage issue. You are compiling a C source code from there as a C++ code (maybe you saved it with C++ specific extensions and the compiler assumed it is C++).
C++ will mangle function names. For example __imp__glutMainLoop#0 is most probabley a call to glutMainLoop in your source code.
The library must have been from a C code. Hence it will have a non mangled version of the function simply as glutMainLoop. That's why it can not be found.
The solution is either compile your code as C code or use extern "C".
EDIT: Some Links on how to deal with with C/C++ linkage issues (Moved from the comments).
http://www.thegeekstuff.com/2013/01/mix-c-and-cpp/
Combining C++ and C - how does #ifdef __cplusplus work?
http://www.parashift.com/c++-faq-lite/c-calls-cpp.html

cppcms lots of unresolved external symbols

I am having errors as follows trying to build cppcms.
Error 184 error LNK2019: unresolved external symbol __imp_pcre_compile referenced in function "public: void __cdecl booster::regex::assign(class std::basic_string,class std::allocator > const &,int)" (?assign#regex#booster##QEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 185 error LNK2019: unresolved external symbol __imp_pcre_exec referenced in function "public: bool __cdecl booster::regex::match(char const *,char const *,class std::vector,class std::allocator > > &,int)const " (?match#regex#booster##QEBA_NPEBD0AEAV?$vector#U?$pair#HH#std##V?$allocator#U?$pair#HH#std###2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 186 error LNK2019: unresolved external symbol __imp_pcre_fullinfo referenced in function "public: void __cdecl booster::regex::assign(class std::basic_string,class std::allocator > const &,int)" (?assign#regex#booster##QEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 187 error LNK2019: unresolved external symbol __imp_pcre_malloc referenced in function "public: __cdecl booster::regex::data::data(struct booster::regex::data const &)" (??0data#regex#booster##QEAA#AEBU012##Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 188 error LNK2019: unresolved external symbol __imp_pcre_free referenced in function __catch$??0data#regex#booster##QEAA#AEBU012##Z$0 C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 189 error LNK2019: unresolved external symbol __imp_htons referenced in function "public: __cdecl booster::aio::endpoint::endpoint(class std::basic_string,class std::allocator > const &,int)" (??0endpoint#aio#booster##QEAA#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\endpoint.obj
My environment is Windows 7 64 bit, using Visual Studio 2012 Professional, and CMake 2.8.9.
For everything I compile, I configure CMake to generate solutions for VS2012 to use the 64 bit compiler. When I do compile the libraries, I compile the release versions.
First I compile Zlib 1.2.7 without a problem.
Second I compile pcre-8.31 without a problem.
Then when it gets time to compile cppcms-1.0.2 I get a bunch or errors as I pointed out before. When configuring cppcms in CMake, I have my PYTHON 2.7 set, I use C:/Stuff/Development/CPP/Zlib/zlib-1.2.7/build for my ZLIB_INCLUDE_DIR, and just append a /Release/zlibstatic.lib at the end of that and you have the ZLIB library I am using, but I am not sure if I have my PCRE set up correctly.
Being that PCRE has an include and include2 in CMake, I wasn't sure what to put in them so I just did the pcre-8.31 root directory, and the pcre-8.31 build directory. For PCRE_LIB I use pcre-8.31/build/Release/pcre.lib.
I have deleted all of the build directories for the libraries and started over again even, but I still have these issues and I am not sure what could be causing them. Later I realized the booster inside of the cppcms build directory also has a solution, so I built that first, which had 3 failed projects, but most succeeded, however it didn't make a difference for cppcms building.
If you have any more questions about what I was doing, please ask and I will edit them in.
The best place to ask questions about cppcms is in the cppcms mailing list. Sign up here:
https://lists.sourceforge.net/lists/listinfo/cppcms-users
Artyom is providing an excellent support service there. Although he is also a S.O. member, not all cppcms developers are, and many of them also provide help on the mailing list. Overall, you'll get better answers there, especially since the people who are able to answer will more quickly notice your question.

OpenCV - SURF functionality issue

I am trying to build an OpenCV program which uses SURF matching algorithm, the code is in the following link :
http://feelmare.blogspot.ro/2011/10/sift-matching-c-source-code-using.html
However, I am obtaining 2 errors regarding some external symbols : _cvExtractSurf and _cvSURFParams.
error LNK2019: unresolved external symbol _cvExtractSURF referenced in function "public: bool __thiscall CMareMatchingClass::ExtractBGsurf(struct _IplImage *)" (?ExtractBGsurf#CMareMatchingClass##QAE_NPAU_IplImage###Z)
error LNK2019: unresolved external symbol _cvSURFParams referenced in function "public: __thiscall CMareMatchingClass::CMareMatchingClass(void)" (??0CMareMatchingClass##QAE#XZ)
Do you know how can I solve this errors? I am running the code by using opencv 2.3.0 in visual studio 2010 in Windows 7 - 64 bit.
You didn't link a needed library - try to link all OpenCV libraries in project settings. See documentation.

Linking Lua with Visual Studio 2010

We use Lua (www.lua.org) script to let users to customize our server software written in C++.
At the moment we are porting the 32 bits Windows version of our project to Visual Studio 2010.
Once everything works fine with VS 2008, we thought that we would have no problem on upgrade process.
Unfortunately whenever we tried to link the lualib (as dll) to our project in VS 2010, the lua functions could not be found by the linker (the error messages are displayed below).
It seems that some calling convention is wrong on 2010, like the application may be looking for the lua functions with a prefix '_'.
To access lua functions (written in C) from our project modules (C++) we use this:
extern "C" {
#include "lua/src/lua.h"
#include "lua/src/lualib.h"
#include "lua/src/lauxlib.h"
}
The same project compiles and links with lualib successfully on VS 2008 and Linux (g++).
Could anybody help me with this ?
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_openlibs referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init#DsCScriptEngine##QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__luaL_newstate referenced in function "public: int __thiscall DsCScriptEngine::Init(void)" (?Init#DsCScriptEngine##QAEHXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_close referenced in function "public: void __thiscall DsCScriptEngine::Shutdown(void)" (?Shutdown#DsCScriptEngine##QAEXXZ)
1>dscscript.obj : error LNK2019: unresolved external symbol __imp__lua_pcall referenced in function "public: long __thiscall DsCScriptEngine::Execute(char const *)" (?Execute#DsCScriptEngine##QAEJPBD#Z)
etc.
The reported missing names are correct, this not a compile problem. You must be linking the wrong .lib. The name you use sounds wrong, it isn't "lualib", the current version of the import library is named lua5.1.lib (or lua51.lib, not sure what the difference is). Download it from here.