Biren Barodia
Biren Barodia

Reputation: 43

Old VS code not running with new VS

I have an old project that I need to revisit. It was built in some version of Visual C++ (prolly 2005) looking at the .sln file. The sln file wont get converted to a VS 2008 solution due to some corruption (dubug point -1). I imported the folder in VS as a new project and tried compiling.

It gave compilation errors for "lang/Typedefs.h/Assertions.h" not there. Removing the declarations I had errors for Uint8/16/32/64 not declared. So I added the typedefs and other macros (TOOLS_UNUSED_PARAMETERS(x) / TOOLS_FORBID_COPY()).

That being ironed out, I got errors for Gui/FileDlg.h and Gui/FolderDlg.h(debug point - 2).

I didnt find any of those header files from any resources online or in my current VS installation and so I am assuming that code is missing and I will have to redo it.

Even these could probably have been custom implemented by the earlier programmer. The current MFC uses CFileDialog and the code uses Gui::FileDlg.

I commented out the code for the time being to see where can I get to since gui is not that big a part of the application. Later I see linker errors corresponding to RegKeyOpenEx calls and outputstream calls(dubug point -3). Winreg.h was not included but windows.h was.

sample :

Error   2   error LNK2019: unresolved external symbol __imp__MessageBoxA@16 
referenced in function "public: class std::basic_ostream<char,struct 
std::char_traits<char> > * __thiscall FileManager::getOutputStream(class Interface   
*,class LogPoint *)" (?getOutputStream@FileManager@@QAEPAV?$basic_ostream@DU?
$char_traits@D@std@@@std@@PAVInterface@@PAVLogPoint@@@Z)    filemanager.obj 
PCAPGenerator

I am not a .Net programmer so can you please suggest what would be the right course of action here ? which debug points should i be focussing on.

Upvotes: 1

Views: 188

Answers (1)

dario_ramos
dario_ramos

Reputation: 7309

RegKeyOpenEx is a Winapi function defined in Advapi32.dll. To link that into a Visual C++ project:

  • If your project is a static library (right-click project->Properties->Configuration Properties->Configuration Type->Static Library (.lib), go to Configuration Properties->Librarian->General->Additional Dependencies and add Advapi32.lib.
  • If your project is a dll (same place, says Dynamic Library (.dll) instead), you'll have the Linker section instead of Librarian. Go to its Input subsection, and add Advapi32.lib to Additional Dependencies.

For your remaining linker errors, proceed in the same way: go to the MSDN doc for the function, check which dll/lib it belongs to and have your project link it in as described above.

Upvotes: 1

Related Questions