Can anyone explain why my simple, 9-lines code do not compile?
#include "stdio.h"
int main(){
HINSTANCE dll_handler;
if (dll_handler = LoadLibrary("theDLL.dll")){
printf("DLL LOADED!!");
}
getchar();
}
All I did was create a new "Empty Project" using Visual C++ (Express Edition 2005) and created a file called main.cpp, there are no other files except for main.cpp
In main.cpp, I inserted the code above. But when I tried to compile it, I got compile errors. After a few modification and more errors, I have found 2 occuring errors:
1. Cannot open include file: 'windows.h': No such file or directory
I don't get it, I've seen other people doing that so why can't I. I'm pretty sure that I'm not missing the header file, because I can successfully include windows.h if I were to use New > Win32 Program. What must I do to be able to include windows.h ?
2. 'HINSTANCE' : undeclared identifier
I've seen people declaring HINSTANCE type variables, how do they do that? What am I missing to be able to use it?
The program was supposed to simply load a dll file, but since I'm new and clueless to the c++ language I had no idea what went wrong.
btw, the program works (compiles and runs successfully) if I remove the #include windows.h part and the HINSTANCE variable declaration along with the dll-loading part.

