Problem code snippet:
#include <iostream>
#include <fstream>
#include <fstream>
int main() {
ofstream myfile;
ofstream myfile;
// TO DO........
return 0;
}
}
Solution code snippet:
#include <iostream>
#include <fstream>
#include <fstream>
using namespace std;
int main() {
ofstream myfile;
ofstream myfile;
// TO DO........
return 0;
}
}
Issue: [Error] cannot convert 'const wchar_t*' to 'LPCSTR {aka const char*}' for argument '1' to 'HINSTANCE__* LoadLibraryA(LPCSTR)'
Problem code snippet:
s_hKernel = LoadLibrary( L"Kernel32.dll" );
Solution code snippet:
s_hKernel = LoadLibrary( "Kernel32.dll" );
Issue: [Error] cannot convert 'PROCESS_MEMORY_COUNTERS_EX* {aka _PROCESS_MEMORY_COUNTERS_EX*}' to 'PPROCESS_MEMORY_COUNTERS {aka _PROCESS_MEMORY_COUNTERS*}' for argument '2' to 'WINBOOL GetProcessMemoryInfo(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD)'
Problem code snippet:
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
Solution code snippet:
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc));
Issue: [Error] cannot convert 'PROCESS_MEMORY_COUNTERS_EX* {aka _PROCESS_MEMORY_COUNTERS_EX*}' to 'PPROCESS_MEMORY_COUNTERS {aka _PROCESS_MEMORY_COUNTERS*}' for argument '2' to 'WINBOOL GetProcessMemoryInfo(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD)'
Problem code snippet:
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
Solution code snippet:
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc));
This is a running collection of common Dev-C++ build errors and their fixes, such as ofstream was not declared in this scope, which happens when the std namespace is not brought in.
Most of these come down to a missing include or a missing using namespace std, and each entry pairs the message with the small change that resolves it.

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.