Это странно.Я получаю ошибки за включение <vector>
: (edit: отлично работает с <list>
, но я не хочу оставлять векторы)
g++.exe -c -g -MMD -MP -MF build/Debug/Cygwin-Windows/main.o.d -o build/Debug/Cygwin-Windows/main.o main.cpp
from MemoryScanner.h:11,
from main.cpp:10:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h: In member function `void std::vector<bool, _Alloc>::_M_insert_range(std::_Bit_iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag)':
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/vector:72,
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h:522: error: expected unqualified-id before '(' token
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h: In member function `void std::vector<bool, _Alloc>::_M_fill_insert(std::_Bit_iterator, size_t, bool)':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h:823: error: expected unqualified-id before '(' token
from MemoryScanner.h:11,
from main.cpp:10:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/vector.tcc: In member function `void std::vector<_Tp, _Alloc>::_M_fill_insert(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp, _Alloc> >, size_t, const _Tp&)':
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/vector:75,
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/vector.tcc:307: error: expected unqualified-id before '(' token
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/vector.tcc: In member function `void std::vector<_Tp, _Alloc>::_M_range_insert(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp, _Alloc> >, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag)':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/vector.tcc:384: error: expected unqualified-id before '(' tokenmake[2]: Leaving directory `/cygdrive/k/Documents and Settings/Administrator/My Documents/NetBeansProjects/MemScan'
make[1]: Leaving directory `/cygdrive/k/Documents and Settings/Administrator/My Documents/NetBeansProjects/MemScan'
make[2]: *** [build/Debug/Cygwin-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
Строки, на которые ссылаются:
#include "MemoryScanner.h" // main.cpp:10
#include <vector> // MemoryScanner.h:12
Редактировать:
MemoryScanner.h
#ifndef MEMORYSCANNER_H
#define MEMORYSCANNER_H
#include <vector>
#include <windows.h>
using namespace std;
struct memblock {
int address;
int value;
};
class MemoryScanner {
private:
HANDLE _hProc;
vector<memblock> _addresses;
public:
MemoryScanner(HANDLE hProc);
MemoryScanner(const MemoryScanner& orig);
void scan(int value);
void display();
virtual ~MemoryScanner();
};
#endif /* MEMORYSCANNER_H */
main.cpp
#include <iostream>
#include <windows.h>
#include "MemoryScanner.h"
using namespace std;
int main(int argc, char** argv) {
HWND hWnd = FindWindow(0, "Calculator");
if (hWnd == 0) {
cout << "Could not retrieve window handler" << endl;
} else {
DWORD pid;
GetWindowThreadProcessId(hWnd, &pid);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if (!hProc) {
cout << "Could not open process" << endl;
} else {
MemoryScanner* scanner = new MemoryScanner(hProc);
int value;
cout << "Enter value: ";
cin >> dec >> value;
scanner->scan(value);
scanner->display();
}
}
return 0;
}