|
Hello there,
I'm getting these linker errors when I compile and execute my VC++ MFC OpenGL application.
I've included the header files for OpenGL.
I've checked all functions for correct parameter type.
Open.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
Open.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Open.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Open.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Open.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Open.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
Open.obj : error LNK2001: unresolved external symbol __imp__glHint@8
Open.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
Open.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
Open.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
Open.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Open.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
Open.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
Open.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
Open.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
Open.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
Open.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
Open.obj : error LNK2001: unresolved external symbol __imp__glClear@4
Debug/Gest_Rep.exe : fatal error LNK1120: 18 unresolved externals
Any ideas whats wrong?
Thanks in advance.
|
|
|
|
|
Looks like you forgot to actually link to the opengl libraries. Do it and the errors will go away.
--
I am perpetual, I keep the country clean.
|
|
|
|
|
Did it and the errors went away
|
|
|
|
|
Given an executable compiled using VC++ (unmanaged), is there a way to identify if the EXE is a debug or release build? Obviously, if you had the two builds side by side, the larger would be the debug, but is there a way to detect if the EXE is a debug build?
Regards
|
|
|
|
|
Well one way would be to check its DLL dependancies and if it was using the MFC/CRT Debug DLL's you'd now. There are probably better ways.
IMO Debug .EXE's should be able to identified by their filename, in the same way Debug DLL's are.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
how about
#ifdef _DEBUG
/* do something here */
#endif
is that what you were asking?
~LizardWiz()
|
|
|
|
|
No, I was looking more for something to determine if a selected EXE is a debug build or not. Not from within code, but if someone just hands you an EXE, how can I determine if it is a DEBUG build.
I think Neville answered my question...just wish there was a little easier solution. I was hoping for something more programmatic...an app I could drag and drop an EXE into or a shell extension that I could use to right click and select on an EXE in Explorer.
thanks for the response, though.
|
|
|
|
|
I have some code that I am having problems with. In the destructor. It is pretty straight forward:
[quote]
{
if( m_pData != NULL )
{
delete [] m_pData;
}
}
[/quote]
I am compiling and running this through MS Visual C++ 6.0. When I create a debug version, and then step through it, it fails at the delete [] m_pData line. I get the following error:
[quote]
"Debug Error!
Program: D:\MyProg\Debug\MyProg.exe
DAMAGE: after Normal block (#55) at 0x04730068.
(Press Retry to debug the application)"
[/quote]
I then hit retry, and I recieve:
[quote]
"User Breakpoint called from code at 0x40cecf"
[/quote]
The debugger is now pointing to:
[quote]
if (!CheckBytes(pbData(pHead) + pHead->nDataSize, _bNoMansLandFill, nNoMansLandSize))
_RPT3(_CRT_ERROR, "DAMAGE: after %hs block (#%d) at 0x%08X.\n",
szBlockUseName[_BLOCK_TYPE(pHead->nBlockUse)],
pHead->lRequest,
(BYTE *) pbData(pHead));
[/quote]
in VC98\CRT\SRC\DBGHEAP.C
When I switch to build a release version, I do not get this error.
What is going on, and how can I fix this.
-Drew
|
|
|
|
|
You need to fix the likely underlying buffer overrun.
(You don't get this error in release because the debug checks are turned off.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
This is what I was afraid of. This is code I have used before(I haven't changed anything). But it has worked fine before without this error. I have located the place where I am filling m_pData and it reads:
[quote]
m_pData = new unsigned char[bitmapInfoHeader->biSizeImage];
if( m_pData == NULL )
{
return false;
}
fread( m_pData, 1, bitmapInfoHeader->biSizeImage, fp );
fclose( fp );
[/quote]
if I change the initial line to:
m_pData = new unsigned char[bitmapInfoHeader->biSizeImage+1];
it works fine.
How is the fread reading in extra data?
Am I misunderstanding how fread works? Am I looking at the wrong part of my code, and this fixes it, but isn't really what causes the problem?
-Drew
|
|
|
|
|
It doesn't look like the fread is causing the problem. One way to verify this is to delete m_pData immediately after the fread() and see if an error is emitted.
(This is where BoundsChecker is invaluable, but its hard to convince the people with the money into getting it. I've been trying for months at my current job to no avail.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks for helping with this. I do:
delete [] m_pData;
right after the fread function. Now I am getting the following error:
"The instruction at "0x00405f3b" refereced memory at "0x04731000". The memory could not be "read"."
This is familiar, but I still can't figure out why fread is doing this. If I do the delete later after I manipulate the memory, I get the previously mentioned error. Does this prompt any ideas about what might be going on?
-Drew
|
|
|
|
|
Are you opening the file in binary mode?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Yes, I am opening it in binary. I believe it is supposed to be(this is an image file). I am using:
if( ( fp = fopen( fileName, "rb" ) ) == NULL )
{
return false;
}
I changed it to "r", and the same problem happened.
|
|
|
|
|
bool CTexture::LoadBMPTexture( char *fileName )
{
BITMAPINFOHEADER texInfo;
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}
if( !LoadBMPFile( fileName, &texInfo ) )
{
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}
return false;
}
if( m_pData == NULL )
{
delete [] m_pData;
m_pData = NULL;
return false;
}
m_nWidth = texInfo.biWidth;
m_nHeight = texInfo.biHeight;
m_pPalette = NULL;
m_nScaledHeight = 0;
m_nScaledWidth = 0;
m_TextureType = BMP;
return true;
}
bool CTexture::LoadBMPFile( char *fileName, BITMAPINFOHEADER *bitmapInfoHeader )
{
FILE *fp;
BITMAPFILEHEADER bitmapFileHeader;
unsigned int imageIdx = 0;
unsigned char tempRGB;
if( ( fp = fopen( fileName, "rb" ) ) == NULL )
{
return false;
}
fread( &bitmapFileHeader, sizeof( BITMAPFILEHEADER ), 1, fp );
if( bitmapFileHeader.bfType != BITMAP_ID )
{
fclose( fp );
return false;
}
fread( bitmapInfoHeader, sizeof( BITMAPINFOHEADER ), 1, fp );
fseek( fp, bitmapFileHeader.bfOffBits, SEEK_SET );
if( m_pData != NULL )
{
delete [] m_pData;
m_pData = NULL;
}
m_pData = new unsigned char[bitmapInfoHeader->biSizeImage];
if( m_pData == NULL )
{
return false;
}
fread( m_pData, 1, bitmapInfoHeader->biSizeImage, fp );
fclose( fp );
if( m_pData == NULL )
{
delete [] m_pData;
m_pData = NULL;
return false;
}
for( imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage; imageIdx += 3 )
{
tempRGB = m_pData[imageIdx];
m_pData[imageIdx] = m_pData[imageIdx + 2];
m_pData[imageIdx + 2] = tempRGB;
}
return true;
}
|
|
|
|
|
The problem is that you are overrunning the buffer in your last for loop.
Even if you were handling the image correctly, which you are not, the correct for statement should be:
for( imageIdx = 0; imageIdx < bitmapInfoHeader->biSizeImage - 2; imageIdx += 3 )
(Note the "-2", in the loop you read/write "imageIdx + 2")
A bigger problem is all rows in a bitmap are aligned to a DWORD boundary. You algorithm will fail if ((width * 3) % 4 != 0)
The loop fails because there are padded bytes which means that biSizeImage is not divisable by three.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thank you very much for the help. Things work fine now. If only I had posted this code first. I was aware of the DWORD boundary issue, and have at this point just limited my images to powers of 2. Is there anywhere you can think of where I could learn a little more about working with images that would fail the test you mentioned?
Again, thank you very much.
-Drew
|
|
|
|
|
Hello all
I've a project which contains a list of .cpp files. I'm using vc++ 6.0. When ever I tried to build the .exe after modifying a single file, vc++ environment is recompiling all the files in my project and building the exe. How do I compile only modified file and link it to build the new .exe ?
Thanks
Hari.
|
|
|
|
|
|
Hi!
How do I get the current gateway IP address?
|
|
|
|
|
Use GetAdaptersInfo () function with an object of structure IP_ADAPTER_INFO as argument. Then if the function success, the IP_ADAPTER_INFO.GatewayList will give you the IP Addresse of default gateway.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
hi,
I would like to know how to open a closed output file !!!!
thanks
Ehsan Behboudi
|
|
|
|
|
A CSV file is a "Comma Seperated Value" file for excel. In that file, the data for each cell is seperated with a comma and a row is seperated with a newline.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Hey folks. Anyone know how to go about closing all browser windows through Visual C++?
|
|
|
|
|
One rather "arbitrary" solution comes to mind, do a window ennumeration via the EnumWindows() API fn, and for each window, get its caption via GetWindowText(), then just look for the "Microsoft Internet Explorer" string insinde the window´s title, if found, send it a WM_CLOSE msg or something like that.
HTH.
|
|
|
|