|
Linker Tools Error LNK2001
When your writing code you have to label the functions, variables, classes, etc... If you label something that it cannot find or is listed twice you will receive an LNK2001 process error. If that doesn't work try this on the main menu of Visual C++ go to project settings, and click on the C/C++ tab. remove _ATL_MIN_CRT from the preprocessor definitions, although depending on what version of Visual C you are running it may automatically be removed. Most likely however their is a function or variable that is listed twice in the Class tree, which again is causing compilation errors. Although if this doesn't work try looking at the error itself at msdn.
Here is the link
feel free to email me if you have any more questions or are still receiving problems
-Mike
|
|
|
|
|
hi, there.
please help me with this urgent problem i have.
use the wizard to build a regular mfc dll project.
include 2 files in your project:
a.h
int a;
a.cpp
#include "stdafx.h"
#include "a.h"
#include "a.h" in your CWinApp derived class' .cpp file.
why the hell do you get LNK2005??
thank you
Я люблю русский языкь!
|
|
|
|
|
Sorry I do not quite understand what you have written.
Although see here LNK2005[^] for reason why you get LNK2005 errors.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi,
I am trying to place an OwnerDrawn ComboBox on a DialogBar. To do this i create a class derrived from CComboBox, and this works fine on a standard CDialog. But i want the control placed on a CDIalogBar. How do i get MFC to instantiate the ComboBox from the derived class rather than CComboBox. Initially i went to use the ClassWizzard to create a class to represent the CDialogbar, however it doesn't allow you to have a base class of CDialogBar and i believe you can't use CDialog in this situation. Anyone any suggestions?
Thanks in advance
Rich
|
|
|
|
|
Found an MSDN article for this scenario - 185672. What sort of forum is this if you have to reply to yourself!
|
|
|
|
|
Hi All,
I want to trap the ctrl+tab, ctrl+f6 etc. in my MDI app, so I can stop WM_MDINEXT, WM_MDIPREV...
I do not want to get into key trapping if possible.
Anyone got any thoughts.
Thanks
Jay
|
|
|
|
|
Hi All,
I want to trap the ctrl+tab, ctrl+f6 etc. So I can stop WM_MDINEXT, WM_MDIPREV.
I do not want to get into key trapping if possible.
Anyone got any thought.
Thanks
Jay
|
|
|
|
|
I downloaded some code off of this site that has the constant NIIF_NONE in it. This has happened to me before, and now again where my app won't build because it can't find these constants. It says in the documentation for the source that this and the other NIIF_ constants are defined in shellapi.h, but I can't find them there. Any help?
[insert witty comment here]
bdiamond
|
|
|
|
|
I also see now in shellapi.h that the above preprocessor is called. I'm guessing this means if my internet explorer version is higher than 5?? I have IE 6, so I don't know what the problem is. I found the #defines for NIIF_NONE and others, but they're not included (or dwInfoFlags). Anybody know why? Any help is appreciated. Thanks!!!
[insert witty comment here]
bdiamond
|
|
|
|
|
You need to define _WIN32_IE to 0x0500 or greater somewhere in your program or as part of the command line eg.
#define _WIN32_IE 0x0500
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
The flags are defined in my copy of shellapi.h as follows:
#if (_WIN32_IE >= 0x0500)
#define NIS_HIDDEN 0x00000001
#define NIS_SHAREDICON 0x00000002
// says this is the source of a shared icon
// Notify Icon Infotip flags
#define NIIF_NONE 0x00000000
// icon flags are mutually exclusive
// and take only the lowest 2 bits
#define NIIF_INFO 0x00000001
#define NIIF_WARNING 0x00000002
#define NIIF_ERROR 0x00000003
#define NIIF_ICON_MASK 0x0000000F
#if (_WIN32_IE >= 0x0501)
#define NIIF_NOSOUND 0x00000010
#endif
#endif
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
duh, I was looking in the wrong place at first, (vc98 include folder) I found them, but now I'm finding that the trouble must be with the IE version defined. I looked it up in the MSDN and found out what it meant, but since I have version 6 of IE, I still don't see what the problem is..Wait, I just got an email where you stated I should define my explorer version. I was just going to ask if I should do that, and will it break something? Oh well, I'm going to try that now. Thanks!!
[insert witty comment here]
bdiamond
|
|
|
|
|
yup, that worked!!! thanks
[insert witty comment here]
bdiamond
|
|
|
|
|
|
Hi,
i tried to modify the codes to display only gray scale image and aslo the original image.So far my program just display a blank bitmap.Anyone can please help me.
void CMy2ndtryView::OnDraw(CDC* pDC)
{
CMy2ndtryDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CDC MemDC;
MemDC.CreateCompatibleDC (NULL);
MemDC.SelectObject (&m_Bitmap);
pDC->BitBlt
(20,
20,
m_BitmapWidth,
m_BitmapHeight,
&MemDC,
0,
0,
SRCCOPY);
CDC resultDC;
CBitmap m_result;
m_result.CreateCompatibleBitmap(pDC,m_BitmapWidth,m_BitmapHeight);
resultDC.CreateCompatibleDC (NULL);
resultDC.SelectObject (&m_Bitmap);
for( int y = 0; y < m_BitmapHeight ; y++ )
{
for( int x = 0; x < m_BitmapWidth ; x++ )
{
//set pixel to color returned by convolve
resultDC.SetPixel(x,y,Convolve(&MemDC,x,y,kernel));
}
}
//Display Result
pDC->BitBlt
(300,
20,
m_BitmapWidth,
m_BitmapHeight,
&resultDC,
0,
0,
SRCCOPY);
}
COLORREF CMy2ndtryView::Convolve(CDC *pDC, int sourcex, int sourcey, float kernel[][3])
{
float rSum = 0, gSum = 0, bSum = 0, kSum = 0;
float grayscale =0;
COLORREF clrReturn = RGB(0,0,0);
for (int i=0; i <= 2; i++)//loop through rows
{
for (int j=0; j <= 2; j++)//loop through columns
{
COLORREF tmpPixel = pDC->GetPixel(sourcex+(i-(2>>1)),sourcey+(j-(2>>1)));
float fKernel = kernel[i][j];
rSum += (GetRValue(tmpPixel)*fKernel);
gSum += (GetGValue(tmpPixel)*fKernel);
bSum += (GetBValue(tmpPixel)*fKernel);
kSum += fKernel;
}
}
if (kSum <= 0)
kSum = 1;
rSum/=kSum;
gSum/=kSum;
bSum/=kSum;
if (rSum > 255)
rSum = 255;
else if (rSum < 0)
rSum = 0;
if (gSum > 255)
gSum = 255;
else if (gSum < 0)
gSum = 0;
if (bSum > 255)
bSum = 255;
else if (bSum < 0)
bSum = 0;
grayscale=0.299*rSum + 0.587*gSum + 0.114*bSum;
rSum=grayscale;
gSum=grayscale;
bSum=grayscale;
clrReturn = RGB(rSum,gSum,bSum);
return clrReturn;
}
Is there something with my formula for grayscale?
grayscale=0.299*rSum + 0.587*gSum + 0.114*bSum;
|
|
|
|
|
Is there a standard way to attach a description to the data being dragged. I require this as the name of the data being dragged can include characters that are invalid in filename field of the FILEGROUPDESCRIPTOR structure (such as slashes or question marks) and I would like to be able to extract the description when the data is dropped. It would appear Outlook just replaces the invalid characters with blanks when creating the filename and then specifies the full name (subject text) as an additional Object Descriptor format.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
hi,
i'm writing a (legacy, non-MFC) dll and there might get an exception thrown in there. it is caught in the exe-file that uses that dll.
dll:
throw new CSomeException();
exe:
catch (CSomeException *e)<br />
{<br />
e->SomeFunction();
delete e;
}
the delete-call crashes because the object is not a valid *local* heap-pointer.
stepping in dbgheap.c reveales the following passage
<br />
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
so, finally. how am i supposed to handle this? i mean throwing an exception in a library isn't that uncommon, is it?
:wq
|
|
|
|
|
I bet at least one of your modules (exe or dll) has CRT statically linked. That means that one instance of CRT is allocating the memory and another one tries to release it ... BANG!
A solution is to link all your modules dinamically (option /MD) against CRT. This way they will share the same CRT instance, and you should be able to allocate memory in one module and release it in another.
Either that, or make sure that each module cleans its own memory.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
bingo! the DLL was set to /MT[d] - I changed that to /MD[d] and it seems to work (just gave it a quick shot)
thx, man!
:wq
|
|
|
|
|
If my memory serves me right, an object new'd by a regular MFC DLL must be destructed by that DLL. An object new'd by an extension MFC DLL can be destructed by the client. See this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
i am reading the first 14 bytes of a bitmap into a struct like this:
struct bmfh
{
unsigned short int bfType;
unsigned long int bfSize;
unsigned short int bfReserved1, bfReserved2;
unsigned long int bfOffBits;
};
and the results come out like this:
type: BM
size: 5
reserved1: 0
reserved2: 1078
bit offset: 3452764160
surely the size and offset cant be correct, does anyone know what i'm doing wrong? other bitmaps give similar values.
|
|
|
|
|
what are the first 14 bytes of the file? (you look at it in VC, if you open it as a "binary" file)
Software | Cleek
|
|
|
|
|
aha, i didnt know you could do that in vc++..
42 4D 9A 31 08 00 00 00 00 00 36 04 00 00
|
|
|
|
|
any reason you're not using MS's BITMAPFILEHEADER struct?
when i do this:
<br />
BYTE buf[14] = {0x42 ,0x4D ,0x9A ,0x31 ,0x08 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x36 ,0x04 ,0x00 ,0x00 };<br />
BITMAPFILEHEADER *b = (BITMAPFILEHEADER *)buf;<br />
the values look fine:
bfType: 19778 ('BM')
bfSize: 536986
bfReserved1: 0
bfReserved2: 0
bfOffBits: 1078
-c
Software | Cleek
|
|
|
|
|
hmm, thats what should happen with mine. i'm just using my own struct to better understand the file format and stuff. as far as i can see, mine is identical to the microsoft one..
|
|
|
|