Posts tagged ‘error lnk2019: unresolved external symbol _ getprocessmemoryinfo@12 referenced in function “void __cdecl printmemoryinfo(unsigned long’

Compiling Errors on GetProcessMemoryInfo function

I recently used GetProcessMemoryInfo function to measure memory usage of working processes on Windows. I firstly tried with the example code “Collecting Memory Usage Information For a Process” in MSDN but the compiling produced some external linking errors on my Windows XP box:

Error 1 error LNK2019: unresolved external symbol _GetProcessMemoryInfo@12 referenced in function “void __cdecl PrintMemoryInfo(unsigned long)” (?PrintMemoryInfo@@YAXK@Z)
Error 2 error LNK2019: unresolved external symbol _EnumProcesses@12 referenced in function _main
Error 3 fatal error LNK1120: 2 unresolved externals

To fix this issue, I added “pragma comment” instruction to places a library-search record in the object file and compiling is now working fine.

#include <windows.h>

#include <stdio.h>

#include <psapi.h>

#pragma comment(lib, “psapi.lib”) //added

May 16, 2010 at 11:56 am 3 comments

IBM Quest Market-Basket Synthetic Data Generator

I recently need IBM Quest Market-Basket Synthetic Data Generator for my study on association rule mining. After a lot of web search effort, I finally found the program source code at the project’s website. There are also many instructions available here. The link to this website has broken recently and I could not find where the site moved to. However, the compling of original source code was failed on my Red Hat 4.1 box. These code was written around 1996 for IBM compliler so some small changes are needed to make it work such as replacing complier  by g++ in Makefile, revising code in gen.h file. You can download the converted code at the link

http://www.cs.indiana.edu/~cgiannel/assoc_gen.html

However, this code still did not work on my machine. It produced a lot of  errors while compliling gen object.

gen.h:185: error: ‘StringSet’ has not been declared
gen.C: In member function ‘void Taxonomy::write_asc(std::ofstream&)’:
gen.C:183: error: ‘setw’ was not declared in this scope
gen.C: In member function ‘void ItemSet::display(std::ofstream&)’:
gen.C:334: error: ‘setprecision’ was not declared in this scope
gen.C: In member function ‘void String::display(std::ofstream&,LINT)’:
gen.C:380: error: ‘setw’ was not declared in this scope
gen.C: At global scope:
gen.C:387: error: prototype for ‘void String::display(std::ofstream&,StringSet&, LINT)’ does not match any in class ‘String’
gen.h:185: error: candidates are: void String::display(std::ofstream&,int&, LINT)
gen.C:378: error: void String::display(std::ofstream&,LINT)
gen.C: In member function ‘void String::display(std::ofstream&,StringSet&, LINT)’:
gen.C:392: error: ‘setw’ was not declared in this scope
gen.C: In member function ‘void StringSet::display(std::ofstream&)’:
gen.C:580: error: ‘setprecision’ was not declared in this scope
gen.C:584: error: call of overloaded ‘display(std::basic_ofstream<char, std::char_traits<char> >&, LINT&)’
is ambiguous
gen.C:378: note: candidates are: void String::display(std::ofstream&,LINT)
gen.h:185: note:  void String::display(std::ofstream&,int&, LINT)
gen.C:587: error: call of overloaded ‘display(std::basic_ofstream<char, std::char_traits<char> >&, LINT&)’
is ambiguous
gen.C:378: note: candidates are: void String::display(std::ofstream&, LINT)
gen.h:185: note:                 void String::display(std::ofstream&,int&, LINT)
gen.C: In member function ‘void StringSet::display(std::ofstream&,StringSet&)’:
gen.C:597: error: ‘setprecision’ was not declared in this scope
gen.C: In member function ‘void Transaction::write_asc(std::ofstream&,LINT)’:
gen.C:775: error: ‘setw’ was not declared in this scope
make.exe: *** [gen.o] Error 1

To fix this issue, I simply added the missing include instructions and declared StringSet class at the top of gen.h file. And now compliling worked well on my machine.

#include “glob.h”
#include “dist.h”
#include <stream.h>
#include <fstream>
#include <iostream>
#include <string>
#include <iomanip> //for settw
using namespace std;
class StringSet;
 

April 27, 2010 at 4:14 pm 15 comments


Recent Posts

/openmp AMD app fixing dead pixel iphone C++ cmd program CPU C sharp dead pixels directory download ibm synthetic data generator Dynamic Dynamic Memory Allocation Edit Environment Variables in Windows Environment Variables error lnk2019: unresolved external symbol _getprocessmemoryinfo@12 referenced in function error lnk2019: unresolved external symbol _ getprocessmemoryinfo@12 referenced in function "void __cdecl printmemoryinfo(unsigned long example code Fixing Dead Pixels and Gray Lines on the iPhone Screen Fixing Dead Pixels on the iPhone Screen Fixing Gray Lines on the iPhone Screen Fix iPhone getprocessmemoryinfo GPU Gray Line iPhone Screen gray lines gray pixels green pixels GUI how to "new" a two-dimension array in C++ how to use ibm quest synthetic data generator ibm data generator ibm quest data generator ibm quest data generator exe ibm quest data mining project ibm quest market-basket synthetic data generator ibm quest market basket market-basket synthetic data generator ibm quest synthetic data generator ibm quest synthetic data generator linux ibm synthetic data generator ibm synthetic generator Intel iPhone Iphone 3G iPhone 3GS iPhone 4 iphone gray lines on startup iphone pixel damage iPhone Screen iPhone screen damage Linux market-basket synthetic data generator Memory Allocation Multicore multithread multi thread multi threaded multithreading mysql extract data into file new OpenCL Path processor quest data generator quest synthetic data generator R SAS Set Environment Variables Set Environment Variables in Windows souce code source code stuck pixels system file two dimension array Windows 7 Windows Vista