|
try deleting the .clw file and rebuilding the clw file by activating classwizard.
|
|
|
|
|
My project is not using MFC, so I don't have a CLW file.
Francisco
|
|
|
|
|
I found the problem: the header files were not directly added to the project, so Class View was not displaying them. Adding them to the project fixed the problem.
Francisco
|
|
|
|
|
IBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Accounts.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
This is my HEADER file
#ifndef ACCOUNTS_H
#define ACCOUNTS_H
class Accounts
{ private:
int num;
int type;
float balance;
public:
Accounts();
int getnum();
void setnum(int n);
int gettype();
void settype(int t);
float getbalance();
void setbalance(float b);
};
#endif
This is my CPP file:
#include "Accounts.h"
#include <string.h>
#include <iostream.h>
int Accounts::getnum()
{ return num; }
void Accounts::setnum(int n)
{ num=n; }
int Accounts::gettype()
{ return type; }
void Accounts::settype(int t)
{type=t; }
float Accounts::getbalance()
{ return balance; }
void Accounts::setbalance(float b)
{ balance =b; }
I appreciate any suggestion.
Thank you
|
|
|
|
|
1. You have included iostream.h - don't. Include iostream and use the things you need from namespace std.
2. Where is your main() function ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I've got a little problem that I just can't get my head around. I'm needing to write a program that can extract files from ace archived files. Basically it would be an installer application for a couple of things I've made up & compressed to make them smaller.
Everything else in the program is working fine, its just a simple MFC dialog program with options for picking the install dir and not a lot else I know that I need to use the unace.dll file from www.winace.com but I just don't know how to use it
Could anyone that might have used it before or knows a bit about dlls be able to point me in the right direction for where I need to include the dll file, how to include it and how to call the functions to get the aces extracted?
Thanks for helping
|
|
|
|
|
Hi!
Download whole package from winace.com (http://www.emerge.de/ftp/dev/unacedll.exe).
It contains not just only dll, but also documentation and sample sources which are rather helpful.
Mukkie
|
|
|
|
|
I have this dll with a routine in it that I what to call.
Lets call it comp1.
So ... I create a project and add a C++ file to it that looks like this
I change my prject setting so that comp1.lib is in that setting
window.
#include <stdio.h>
#include "comp1.h"
void main( int argc, char * argv[] ) {
char array[19];
comp1( "blah", "blah1", "blah3", array );
}
I compile ok but when I link I get this error
LNK2001: unresolved exteranl symbol "int __cdecl comp1( char *, char*, char*, char *const)" (?comp1@@YAHOOSOMETHING@Z)
What am i doing wrong?
|
|
|
|
|
Try using:
#pragma comment(lib, "comp1.lib")
See if that works.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
#pragma works
It tells me it cannot open comp1.lib
I have copied comp1.lib to every directory on my hard drive!
How can I get pragma to tell why it cannot open comp1.lib?
Thanks!
|
|
|
|
|
oops correction ... compl.lib was not in te right directory.
I have copied it to the right place now and pragma lib doesn't
say anything now. and I am now doing a the
extern "C" {
...
}
... bit and now I get LNK1106: invalid file or disk full: cannot seek 0xa3298473298
AAARRRRRRGGGGGHHHHH!!!!!
help!
|
|
|
|
|
Now there is some errors in my code, but it's late now and I have to go to bed!
But can you tell me how to do this:
// dir_bcast_addr is a u_long and is wron type to fit..
bcast.sin_addr.s_addr = inet_addr(dir_bcast_addr);
int main()
{
WSAData wsaData;
int nCode;
if ((nCode = WSAStartup(MAKEWORD(2, 0), &wsaData)) != 0)
{
cout << "Ett fel inträffades när Winsock skulle startas, felkod " << nCode << "." << endl;
return 1;
}
SOCKET s;
BOOL bBroadcast;
char *sMsg = "This is a test";
SOCKADDR_IN bcast;
s = WSASocket(AF_INET, SOCK_DGRAM, 0, NULL, 0, WSA_FLAG_OVERLAPPED);
bBroadcast = TRUE;
setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&bBroadcast, sizeof(BOOL));
u_long host_addr = inet_addr("192.169.244.152");
u_long net_mask = inet_addr("255.255.255.128");
u_long net_addr = host_addr & net_mask;
u_long dir_bcast_addr = net_addr | (~net_mask);
bcast.sin_family = AF_INET;
bcast.sin_addr.s_addr = inet_addr(dir_bcast_addr);
bcast.sin_port = htons(5150);
sendto(s, sMsg, strlen(sMsg), 0, (SOCKADDR *)&bcast, sizeof(bcast));
while(TRUE)
{
char* buffer = new char[1024];
SOCKADDR_IN sender;
int sos = sizeof(sender);
int ret = recvfrom(s, buffer, sizeof(buffer), MSG_OOB, (SOCKADDR*)&sender, &sos);
if (ret == SOCKET_ERROR)
{
printf("recvfrom() failed; %d\n", WSAGetLastError());
break;
}
else if (ret == 0)
{
break;
}
else
{
buffer[ret] = '\0';
printf("[%s] sent me: '%s'\n", inet_ntoa(sender.sin_addr), buffer);
}
delete [] buffer;
}
closesocket(s);
WSACleanup();
return 0;
}
The error code is 10045 and it means that the function call or something is nott allowed!!???
Now I have to go and sleep!
See ya to morrow!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
I have been working on double buffering my CListView for the past few days... After this bit of code below, my list is now flicker free. The only problem I am having is that my Header wasn't being drawn.. When I add my code to draw the Header my items are shifted down for example.. when I add a item to row 1 its drawn in row 2 (row 1 appears empty) so if you click the mouse on the empty row 1 it highlights row 2, and so on.. if I exclude the code for the Header all the items are drawn correctly.
Any ideas on what I am doing wrong?
void CMyListView::OnPaint()
{
CRect rc;
CRect rcWnd;
CRect rcH;
CPaintDC dc(this);
CDC MemoryDC;
CBitmap Bitmap;
CBrush Brush;
GetParent()->GetClientRect(&rc);
if (rc.Size() == CSize(0,0))
return;
GetParent()->GetWindowRect(&rcWnd);
CHeaderCtrl* pHC = (CHeaderCtrl*)(GetListCtrl().GetDlgItem(0));
if(pHC != NULL)
{
pHC->GetItemRect(0,&rcH);
rc.top += rcH.bottom;
}
int rcWndW = rcWnd.Width(), rcWndH = rcWnd.Height();
TRACE("%d %d", rcWndW, rcWndH);
MemoryDC.CreateCompatibleDC(&dc);
Bitmap.CreateCompatibleBitmap(&dc, rcWndW, rcWndH);
CBitmap *pOldBitmap = MemoryDC.SelectObject(&Bitmap);
Brush.CreateSolidBrush(dc.GetBkColor());
MemoryDC.FillRect(&CRect(0,0, rcWndW,rcWndH), &Brush);
Print(&MemoryDC, PRF_CLIENT);
Print(&MemoryDC,PRF_OWNED);
CRect rcDraw = rc - rc.TopLeft();
dc.BitBlt(rc.left,rc.top, rc.Width(),rc.Height(), &MemoryDC, rcDraw.left,rcDraw.top, SRCCOPY);
MemoryDC.SelectObject(pOldBitmap);
}
|
|
|
|
|
RobJones wrote:
if I exclude the code for the Header all the items are drawn correctly.
But the header isn't? I wouldn't think you'd have to allow for it, really.
In any case, this line:
CRect rcDraw = rc - rc.TopLeft();
appears to be doubling the offset for rcDraw , probably not what you really want (all drawing done by Print() assumes client coodinates AFAIK, so the top of the client area is drawn at (0,0)).
--------
This is what we've waited for
This is it boys, this is War! --Shog9 --
|
|
|
|
|
I remarked the line you suggested and set the following.. its still doing the same thing .
dc.BitBlt(rc.left,rc.top, rc.Width(),rc.Height(), &MemoryDC, 0,0, SRCCOPY);
Could it be that i am some how not including the header in both the dc's?
Im at home so its showing the post as Anonymous.
|
|
|
|
|
Anonymous wrote:
Could it be that i am some how not including the header in both the dc's?
Possibly. But, rc.top is not going to be 0 either; it will be the height of the header. The line should read:
dc.BitBlt(rc.left,rc.top, rc.Width(),rc.Height(), &MemoryDC, rc.left,rc.top, SRCCOPY);
I'm curious as i've never tried doing this: is the header actually drawn into the buffer? Or does it get painted separately.
Good Luck
--------
This is what we've waited for
This is it boys, this is War! --Shog9 --
|
|
|
|
|
You Are the MAN!!
Thanks!
Rob
|
|
|
|
|
I'm using MAPIAddress() to allow selection of addresses. I'd like to set the default button as To/Cc/Bcc depending on which one the user is looking to add; does anyone know of a (preferably clean) way to accomplish this?
--------
This is what we've waited for
This is it boys, this is War! --Shog9 --
|
|
|
|
|
arg.. any help would be much appreciated..
i have a function called PopulateTree() which is supposed to remove all items currently in the tree, and repopulate it.
the problem is that everytime i call DeleteAllItems() and then add more items the new items never show up. ex:
m_tcReports.DeleteAllItems();
HTREEITEM hDoc = m_tcReports.InsertItem("wtf", NULL, TVI_SORT);
if i remove the DeleteAllItems() call then it will add the items everytime i call the function causing multiple copies of the same item.. but at least it adds the items.
is there something i have to do between DeleteAllItems() and adding a new item? ive tried Invalidate(), but that was to no avail..
also i've noticed that my message handler below always gets called 2 times in a row, any idea why?
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_PERIODBEGIN, OnDtnDatetimechangePeriodbegin)
plz help this newbie out friendly ppl have a good weekend!
-dz
|
|
|
|
|
I think you need to do use TVI_ROOT instead of NULL in your call to InsertItem() .
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
thanks for the suggestion, but it still doesn't work.. i have tried to just delete the items one at a time in a loop instead of using deleteallitems() and then adding my items, but they still don't show up.. if i get rid of the deleteallitems() call they do show up.. i just don't get it.
-dz
|
|
|
|
|
The buttons with mnemonic could be acted pressing ALT+CHAR. But, sometimes I can press only the CHAR and the button is acted.
Anyone knows how solve this problem ?
Thanks,
Cristiano.
|
|
|
|
|
It's not a problem - it's normal behavior.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
But it can be a unwished behavior. To call any menus's function you must press ALT to act the mnemonics and then press another key to act the menu's function.
Is there any configuration or way to avoid act the function without press ALT ?
Thanks,
Cristiano.
|
|
|
|
|
[Intentionally posted in the VC++ forum instead of the Lounge]
Have you used (or do you use) QT to develop Win/Unix GUI apps? If so, I'd be grateful for your comments. Some of us are considering using QT at work, where cost is not an issue, but performance, ease of use, and good tech support is. Our apps are used primarily by hardware engineers, and the types of GUIs we build have a lot of graphical displays.
Thanks,
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|