I have created the project. The project type is "Win32 DLL". There is the
following string in my project:
HDC hCDC = CreateCompatibleDC(hdc);
I see following error after compiling:
undefined reference to `CreateCompatibleDC@4'
But if i will create the project with type "Win32 GUI" and put this string
into it it will compiles without any errors. Why?
How can I compile my project with type "Win32 DLL"?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't know if "linked automatically" is the best way to put that. Maybe
someone else here knows exactly how that works, I just seem to remember seeing
somewhere long ago that GUI projects add some libraries without you having to
explicitly link them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The function declaration “CreateCompatibleDC” is in a file “wingdi.h”. This
file is connected to the project as follows: “Tools-> CompilerOption->
Directories-> CInclude” the path “C:\Dev-Cpp\include \is specified”. Here
there is a file “wingdi.h”. The function description “CreateCompatibleDC” in
library “libgdi32.a”. This library is to the address “C:\Dev-Cpp\lib \”. It is
the address it is specified in compiler customisations: “Tools->
CompilerOption-> Directories-> Libraries”.
Specified above customisation are identical to both projects, but for the type
project “WIN32 DLL” the compiler produces an error. For the type project
“WIN32 GUI” compilation passes successfully.
In a directory with the type project “WIN32 DLL” I have copied a file
“libgdi32.a”. Also has made following customisations: “Project->
ProjectOptions-> Parameters-> Linker” has entered a filename “libgdi32.a”.
Compilation has passed successfully.
Why? After all the file “libgdi32.a” should be connected to the project
without additional customisations?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have created the project. The project type is "Win32 DLL". There is the
following string in my project:
HDC hCDC = CreateCompatibleDC(hdc);
I see following error after compiling:
undefined reference to `CreateCompatibleDC@4'
But if i will create the project with type "Win32 GUI" and put this string
into it it will compiles without any errors. Why?
How can I compile my project with type "Win32 DLL"?
I am sorry if I have put my question to the wrong section.
You need to link to gdi32.lib
I believe this gets linked automatically when you choose Win32 GUI project,
but not for Win32 DLL.
How I can see, what files get linked automatically to a project?
I don't know if "linked automatically" is the best way to put that. Maybe
someone else here knows exactly how that works, I just seem to remember seeing
somewhere long ago that GUI projects add some libraries without you having to
explicitly link them.
The function declaration “CreateCompatibleDC” is in a file “wingdi.h”. This
file is connected to the project as follows: “Tools-> CompilerOption->
Directories-> CInclude” the path “C:\Dev-Cpp\include \is specified”. Here
there is a file “wingdi.h”. The function description “CreateCompatibleDC” in
library “libgdi32.a”. This library is to the address “C:\Dev-Cpp\lib \”. It is
the address it is specified in compiler customisations: “Tools->
CompilerOption-> Directories-> Libraries”.
Specified above customisation are identical to both projects, but for the type
project “WIN32 DLL” the compiler produces an error. For the type project
“WIN32 GUI” compilation passes successfully.
In a directory with the type project “WIN32 DLL” I have copied a file
“libgdi32.a”. Also has made following customisations: “Project->
ProjectOptions-> Parameters-> Linker” has entered a filename “libgdi32.a”.
Compilation has passed successfully.
Why? After all the file “libgdi32.a” should be connected to the project
without additional customisations?