Thread: [Dev-C++] Strange linking problem (?)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Hielke <hie...@he...> - 2004-08-19 17:28:37
|
Hi all,
During the compilation of the following constructor I get a =
"'GetInstance' undeclared" error. However I included an headerfile which =
includes the appropriate header (windows.h) to use that function.
// topwindow1.cc
#include "windowwrappers.ih"
TopWindow::TopWindow(WindowClass &winClass, int resId)
:
Window(winClass)
{
d_style =3D WS_OVERLAPPEDWINDOW;
HINSTANCE hInst =3D GetInstance();
d_windowName =3D ResourceString(hInst, resId);
}
// windowwrappers.ih
#include "window.h"
#include "topwindow.h"
#include "../winexception.h"
#include "../resourcestring.h"
#include <windows.h>
I don't get why it won't compile. Especially because I use the very same =
function in a classmember of another class:
// setdefaults.cc
#include "classwrappers.ih"
void WindowClass::SetDefaults()
{
/* <some code> */
d_class.lpszClassName =3D GetName();=20
d_class.hInstance =3D GetInstance();=20
/* <some more code> */
}
// classwrappers.ih
#include "simplewindowclass.h"
#include "windowclass.h"
#include "topwindowclass.h"
#include "../resourcestring.h"
#include "../winexception.h"
#include <windows.h>
#include <string>
Note that I use a nonstandard extension for the headerfiles (following =
the "internal header" approach where classmembers include a common =
headerfile (which in turn includes the header containing =
classdeclaration)). This might be the cause of linker problems when =
using Dev-C++ but I already tried projectfile options. Currently the =
*.ih files are neither included during compilation nor during =
linkingprocess.
Thanks in advance. Hope somebody sees what I'm doing wrong.=20
Regards,
Hielke
zw...@he... |
|
From: Billiam <bon...@ya...> - 2004-08-19 22:01:23
|
Do you have all the libraries linked to it that you should have? That might be the problem, but Im not sure.
Hielke <hie...@he...> wrote:Hi all,
During the compilation of the following constructor I get a "'GetInstance' undeclared" error. However I included an headerfile which includes the appropriate header (windows.h) to use that function.
// topwindow1.cc
#include "windowwrappers.ih"
TopWindow::TopWindow(WindowClass &winClass, int resId)
:
Window(winClass)
{
d_style = WS_OVERLAPPEDWINDOW;
HINSTANCE hInst = GetInstance();
d_windowName = ResourceString(hInst, resId);
}
// windowwrappers.ih
#include "window.h"
#include "topwindow.h"
#include "../winexception.h"
#include "../resourcestring.h"
#include <windows.h>
I don't get why it won't compile. Especially because I use the very same function in a classmember of another class:
// setdefaults.cc
#include "classwrappers.ih"
void WindowClass::SetDefaults()
{
/* <some code> */
d_class.lpszClassName = GetName();
d_class.hInstance = GetInstance();
/* <some more code> */
}
// classwrappers.ih
#include "simplewindowclass.h"
#include "windowclass.h"
#include "topwindowclass.h"
#include "../resourcestring.h"
#include "../winexception.h"
#include <windows.h>
#include <string>
Note that I use a nonstandard extension for the headerfiles (following the "internal header" approach where classmembers include a common headerfile (which in turn includes the header containing classdeclaration)). This might be the cause of linker problems when using Dev-C++ but I already tried projectfile options. Currently the *.ih files are neither included during compilation nor during linkingprocess.
Thanks in advance. Hope somebody sees what I'm doing wrong.
Regards,
Hielke
zw...@he...
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers! |
|
From: Hielke <hie...@he...> - 2004-08-19 23:23:54
|
Billiam wrote: > Do you have all the libraries linked to it that you should have? That > might be the problem, but Im not sure. That's probably not it cause as mentioned I did use the GetInstance() API call on another place with the very same includes. The (internal)header files included by the source only include self-implemented classheaderfiles besides the <windows.h> header. Those classes do not include any other header not also mentioned in those internal headers. That's why I think it is a linkerproblem. However I don't get it solved no matter what change in the projects filesettings. Regards, Hielke zw...@he... |
|
From: Scott S. <age...@co...> - 2004-08-20 00:02:38
|
Try changing the order you include headers. Normally you have to include the Windows header first. Also, you can try another compiler, like the MSVC++ compiler. Look around on MSDN for it, you can download just the compiler for free. Or you can try Borland's command line compiler. Hielke wrote: > Billiam wrote: > >> Do you have all the libraries linked to it that you should have? That >> might be the problem, but Im not sure. > > > That's probably not it cause as mentioned I did use the GetInstance() > API call on another place with the very same includes. The > (internal)header files included by the source only include > self-implemented classheaderfiles besides the <windows.h> header. > Those classes do not include any other header not also mentioned in > those internal headers. That's why I think it is a linkerproblem. > However I don't get it solved no matter what change in the projects > filesettings. > > Regards, > Hielke > zw...@he... > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |