|
Hi Folks,
I am facing a little problem executing my program..
I am using an MFC APP Wizard Application, which was running fine untill I added a function[ Find() ] in my View class which uses a global function [ int getAngle() ].
I defined my global Function and Variable in a seprate header and use #include "Global.h" on top of my View Class (.h).
If i dont define this global function [ int getAngle() ] in "Global.h" and build my program the compiler complains about [ int getAngle() ] not declared and used in function [ Find() ].
But as soon i define the function [ int getAngle() ] in "Global.h" and build my program i get linker errors saying
"SimulationView.obj : error LNK2005: "int __cdecl GetMap(int,int)" (?GetMap@@YAHHH@Z) already defined in Simulation.obj
...
SimulationView.obj : error LNK2001: unresolved external symbol "int __cdecl getAngle(class MapNode,class MapNode)" (?getAngle@@YAHVMapNode@@0@Z)
Debug/Simulation.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. "
Can anyone of u guys figure out whts the problem ???
Regards,
JinBaba
|
|
|
|
|
It looks like you are including Global.h in more than one spot. You need to add something like the following to it:
#ifndef _GLOBAL_H
#define _GLOBAL_H
int getAngle();
#endif
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi David,
The thing is i am including "Global.h" in more than one spot.. but i have already followed the convention of
#ifndef _GLOBAL_H
#define _GLOBAL_H
#endif
but I still get the same problem.
Your Response needed..
Regards,
JinBaba
|
|
|
|
|
You might also employ the #pragma once directive.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi David,
The thing is i am including "Global.h" in more than one spot.. but i have already followed the convention of
#ifndef _GLOBAL_H
#define _GLOBAL_H
#endif
but I still get the same problem.
Your Response needed..
Regards,
|
|
|
|
|
D3D 2D Texture(PNG File) How to set ColorKey
I have a PNG(or TGA or DDS) file,I want to create a texture with ColorKey dependendts on PNG's transparent color.
BOOL DoInit()
{
D3DPRESENT_PARAMETERS d3dpp;
D3DDISPLAYMODE d3ddm;
BYTE *Ptr;
#define PNG_WIDTH 256.0f
#define PNG_HEIGHT 256.0f
sVertex Verts[4] = {
{ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f },
{ PNG_WIDTH, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f },
{ 00.0f, PNG_HEIGHT, 1.0f, 1.0f, 0.0f, 1.0f },
{ PNG_WIDTH, PNG_HEIGHT, 1.0f, 1.0f, 1.0f, 1.0f }
};
// Do a windowed mode initialization of Direct3D
if((g_pD3D = Direct3DCreate8(D3D_SDK_VERSION)) == NULL)
return FALSE;
if(FAILED(g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
return FALSE;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = FALSE;
if(FAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &g_pD3DDevice)))
return FALSE;
// Create the vertex buffer and set data
g_pD3DDevice->CreateVertexBuffer(sizeof(sVertex)*4, 0, VERTEXFVF, D3DPOOL_DEFAULT, &g_pVB);
g_pVB->Lock(0,0, (BYTE**)&Ptr, 0);
memcpy(Ptr, Verts, sizeof(Verts));
g_pVB->Unlock();
// Load the texture map
D3DXCreateTextureFromFile(g_pD3DDevice, "Image1.png", &g_pTexture);
return TRUE;
}
|
|
|
|
|
Hi all,
can any1 refer me to code samples
on how to display preview of my web cam using Direct show??
couldn't find it anywhere...
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi,
i am modifying my partition table to create a new partition .But the system shows the newly created only after restarting the system. Is there any way to do this without restarting the system. I try BroadcastSystemMessage() with WM_DEVICECHANGE
but it is not working may be the parameters are not correct. Can anyone tell me how to use this function or some other function to refresh the sytem without restarting.
Thanks.
|
|
|
|
|
ashtwin wrote: I try BroadcastSystemMessage() with WM_DEVICECHANGE
but it is not working...
What is the error?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi,
thanks for replying. I mean that though the function is returning 1 after execution but the system is still showing the same no of partitions even after the entry of newly created partition are inserted into the partition table.
I am using the function as
BOOL abc=BroadcastSystemMessage(BSF_POSTMESSAGE, BSM_ALLCOMPONENTS, WM_DEVICECHANGE, DBT_CONFIGCHANGED, 0);
Also i have tried with DBT_CONFIGCHANGED insted of DBT_CONFIGCHANGED but the result reamins the same.
Thanks.
|
|
|
|
|
When i compiled my program i got the error "Debug Assertion Failed".I referred for that error in msdn .But i cant understand it.can you tell me how can i delete this error.
|
|
|
|
|
keerthikaaa wrote: When i compiled my program i got the error "Debug Assertion Failed".
What line of what file?
keerthikaaa wrote: can you tell me how can i delete this error.
Not without knowing what is causing it.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Any time you get an assert look for the line that is asserting in your debugger. If the answer isn't immediately obvious after doing so more often then not you will find a comment describing what the problem is. If there isn't, and the assert is in code you manage, put one in.
Steve
|
|
|
|
|
|
look up CToolTipCtrl class in MSDN there are guided steps on how to use it....
good luck
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Add the LVS_EX_INFOTIP extended style and the control will show an infotip over items that are truncated.
If you want more complex infotips, handle LVN_GETINFOTIP .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
What is Slicing Problem in C++.How it is Occured? what is the best solution for it ?
krishna
|
|
|
|
|
I think it has something to do with process/job scheduling (e.g., each gets a slice of the CPU for X units of time).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I guess you are referring the object slicing issue in c++ while passing class objects as by value in function parameters.
This issue happens when we are passing a derived class object as by value parameter to a function and there if we receive it into a variable of a base class type.
In this scenario generally, a derived class object will have more data members than its base or ancestor class objects, so the compiler, without complaining, simply "slices off" the extra data members of the derived class object and uses only the members inherited from the base or ancestor class for the base or ancestor class variable. However, when references or pointers to base arguments are used, this "slicing" does not occur, which is one of the reasons that references and pointers are so important in C++ OOP.
cheers mil10.
|
|
|
|
|
Thank you mil, You clarified my assumptions in Object Slicing.
It is helped me to understand the code i have.
|
|
|
|
|
I NEED B TREE INSERTION AND DELATION CODE.PLE HELP THANKS
WAQAS
|
|
|
|
|
Ok, so Google for it.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
void MyFun()
{
Fun1();
FunSendingMessage();
.........code
}
void MessageHandlerFun()
{
.........code
.........code
}
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
That's what will happen automatically if you use the SendMessage API to send the message.
Steve
|
|
|
|
|
the program control will run MyFun()
then it will call FunSendingMessage(), since it is using SendMessage, the main function MyFun will not regain control until the function MessageHandleFun() will finish and return....
so basically you don't have to do anything
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|