|
Was a linkedlist.obj file produced?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
below is the output & there object files for all source files.
Compiling...
linkedlist.cpp
-+- COMPILING i:\program\user\richard millen\source\_dev\list_test\list_test\linkedlist.cpp
-+- COMPILING i:\program\user\richard millen\source\_dev\list_test\list_test\linkedlist.h
-+- COMPILING i:\program\user\richard millen\source\_dev\list_test\list_test\linkedlist.h
main.cpp
-+- COMPILING i:\program\user\richard millen\source\_dev\list_test\list_test\main.cpp
-+- COMPILING i:\program\user\richard millen\source\_dev\list_test\list_test\linkedlist.h
-+- COMPILING i:\program\user\richard millen\source\_dev\list_test\list_test\linkedlist.h
i take it linkedlist.h is being run through the compiler twice because there are 2 classes in there (linkedlist & listelement)!?
|
|
|
|
|
Is there a way in a CFormView-based class to get a control by it's id like GetDlgItem() that returns a (CWnd*)
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
Is there a way in a CFormView-based class to get a control by it's id like GetDlgItem() that returns a (CWnd*)
You may need to rephrase this question , but you have just answered your own question. GetDlgItem() should work as described in any CFormView class.
I Dream of Absolute Zero
|
|
|
|
|
Can someone point me in the right direction for creating a download progress dialog while an activeX control is installing. I presume it's some kind of callback but would appreciate some help. (examples)
thanks in advance
Carl
|
|
|
|
|
Hi, I've got a need to include an .exe inside a dll. Basically the dll is downloaded from a web site and needs to copy (unpack) the .exe to a destination directory. My first thought is to include it as a custom resource. Before going down that road i would like to know if anyone can offer a better solution?
thanks - Carl
|
|
|
|
|
There's nothing wrong with your approach. See here for an example.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks David! - just what i was looking for
One question...
Do you know if this could be done with an activeX control? (MFC based)
I'm going to try it but wondered if you might know.
Carl
|
|
|
|
|
crandall wrote:
Do you know if this could be done with an activeX control?
It'll work for any file. Bytes in a file don't mean anything until the application that understands them gets involved. All you are doing is taking a bunch of bytes and adding them as a resource to some other file. Whether you added winword.exe or mypict.jpg to your .exe file, bytes are bytes.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I think you may have misundertood me a little. i meant adding an application (bytes) to the activeX control. I guess it's the same but i just wondered as a certain structure is assumed to qualify to be a COM object etc.
Thanks
Carl
|
|
|
|
|
crandall wrote:
I think you may have misundertood me a little.
Apparently I misunderstood you a bunch. I do not know how to add to an ActiveX at runtime.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Do you fancy having a look at the above Message of mine on the download Progress for an activeX control.
Thanks in advance!
Carl
|
|
|
|
|
I don't quite understand your request. I don't see mention of any progress control in any of your posts in this thread. Did I miss it?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Dear friends,
I got an edit box, the user enters the string in the edit box that my application collects in the associated CString variable m_edit_customerAddress .
But the problem is that users are entering characters like "space bars", "tabs" "new line" , in the beginning of the string and at the end of the string. What i want to remove thiese characters from m_edit_customerAddress . How can i do so ?
Imtiaz
|
|
|
|
|
Imtiaz Murtaza wrote:
...users are entering characters like "space bars", "tabs" "new line" , in the beginning of the string and at the end of the string.
Is this a multi-line edit control? In any case, after the variable is populated with the control's contents, simply call iswhite() for each character.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
You can use the CString member function ::TrimLeft() and ::TrimRight() to remove any unwanted characters at either end of your string.
If your string has a mixture of these characters, then its a bit more difficult to infer where your 'valid' input string starts and ends.
I Dream of Absolute Zero
|
|
|
|
|
Ok..So I'm making a program for the "Connect Four" game. You know the one that you try to get 4 colors in a row by dropping a chip in between 2 players.
Well My problem is my function called displayBoard this method places 2 different kinds of markers on the board (one for each player) and displays some kind of marker for empty slots. Be sure your choices are easy to see.(i.e. X's for player 1, O's for players 2)
Well having the data members being...
//data members
int board[12][13];
int numChips[7];
how would I write the function...displayBoard?
All I have so far is this in my .cpp file
void ConnectFour::displayBoard()
{
for(int i=0; i < 12; i++)
{
for(int j=0; j<13; j++)
{
cout << board[i][j] <<" ";
}
cout << endl;
}
}
|
|
|
|
|
The displayBoard() method is fine. What you need to do is populate the board variable with Xs and Os.
You need a method that asks the user which of the seven slots they want to insert a piece into. If that slot is not full, add a piece to it (this is the real meat of your program). Otherwise, tell them the slot is full and ask again.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
ok...but all i have is
cout << "What column do you want to drop a chip in?;
cin >> //do i use an arrary for cin?
for(int j=0; j<13; j++)
{
cout << board[j] << "X";
}
~jason
|
|
|
|
|
Based on this this picture, you should have a 6-row by 7-column board. That said, you could have something like:
int nColumn;
cout << "What column do you want to drop a chip in (1-7)? ";
cin >> nColumn;
for (int nRow = 0; nRow < 6; nRow++)
{
if (' ' == board[][])
{
board[][] = 'X';
break;
}
} I'll leave the two [][] for you to conquer.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How's it going with this exercise?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Good..I got it takeing care of....thanks for checking up on me! I have so much trouble with this class. I"m strungling to pass =\
~Jason
|
|
|
|
|
hi!
i've just finished writing a linked list template class, which compiles fine, but when i try to use it in another file (main.cpp) in my console test app' i get LNK2019 errors for every method of the class being used. i've copied the class & output below, so if anyone has any ideas i would REALLY appreciate some help because i'm completely stuck!! thanks!!
#ifndef _LINKEDLIST_H_
#define _LINKEDLIST_H_
#pragma message (" -+- COMPILING " __FILE__)
// declare classes...
template <class type> class ListElement;
template <class type> class LinkedList;
/*
************************
linkedlist class
************************
*/
template <class type> class LinkedList
{
public:
//
// constructor/destructor
//
LinkedList<type>();
~LinkedList<type>();
//
// public methods
//
bool InsertNext(ListElement<type>* pElement, const type* pData);
bool RemoveNext(ListElement<type>* pElement, type** ppData);
ListElement<type>* GetHead();
ListElement<type>* GetTail();
int GetSize();
bool IsHead(const ListElement<type>& element);
bool IsTail(const ListElement<type>& element);
bool IsEmpty();
ListElement<type>* GetElementByIndex(int index);
LinkedList<type>* Clone();
LinkedList<type>* Copy();
void FreeData();
private:
//
// private methods
//
void SetHead(ListElement<type>* pHead);
void SetTail(ListElement<type>* pTail);
void SetSize(int size);
//
// private member data
//
int m_size;
ListElement<type>* m_pHead;
ListElement<type>* m_pTail;
};
/*
*************************
listelement class
*************************
*/
template <class type> class ListElement
{
public:
//
// constructor/destructor
//
ListElement();
~ListElement();
//
// public methods
//
type* GetData();
void SetData(type* pData);
void FreeData();
ListElement<type>* GetNext();
void SetNext(ListElement<type>* pNext);
type* CloneData();
private:
//
// private member data
//
type* m_pData;
ListElement<type>* m_pNext;
};
#endif // _LINKEDLIST_H_
#pragma message (" -+- COMPILING " __FILE__)
#include <stdlib.h>
#include "linkedlist.h"
/*
************************
linkedlist class
************************
*/
template <class type>
LinkedList<type>::LinkedList() : m_size(0), m_pHead(NULL), m_pTail(NULL)
{
// do nothing
}
template <class type>
LinkedList<type>::~LinkedList()
{
if (m_pHead != NULL)
delete m_pHead;
}
template <class type>
bool LinkedList<type>::InsertNext(ListElement<type>* pElement, const type* pData)
{
ListElement<type>* pNewElement = new ListElement<type>;
if (pNewElement == NULL)
return false;
pNewElement->SetData(const_cast<type*> (pData));
if (pElement == NULL) // insertion @ head of list...
{
if (this->GetSize() == 0)
this->SetTail(pNewElement);
pNewElement->SetNext(this->GetHead());
this->SetHead(pNewElement);
}
else // insertion somewhere other than @ the head...
{
if (pElement->GetNext() == NULL)
this->SetTail(pNewElement);
pNewElement->SetNext(pElement->GetNext());
pElement->SetNext(pNewElement);
}
this->SetSize(this->GetSize() + 1);
return true;
}
template <class type>
bool LinkedList<type>::RemoveNext(ListElement<type>* pElement, type** ppData)
{
ListElement<type>* pOldElement;
if (this->GetSize() == 0)
return false;
// if null then handle removal from head of list...
if (pElement == NULL)
{
*ppData = this->GetHead()->GetData();
pOldElement = this->GetHead();
this->SetHead(this->GetHead()->GetNext());
if (this->GetSize() == 1)
{
this->SetTail(NULL);
}
}
else
{
if (pElement->GetNext() == NULL)
return false;
*ppData = pElement->GetNext()->GetData();
pOldElement = pElement->GetNext();
pElement->SetNext(pElement->GetNext()->GetNext());
if (pElement->GetNext() == NULL)
{
this->SetTail(pElement);
}
}
delete pOldElement;
this->SetSize(this->GetSize() - 1);
return true;
}
template <class type>
ListElement<type>* LinkedList<type>::GetHead()
{
return m_pHead;
}
template <class type>
ListElement<type>* LinkedList<type>::GetTail()
{
return m_pTail;
}
template <class type>
int LinkedList<type>::GetSize()
{
return m_size;
}
template <class type>
bool LinkedList<type>::IsHead(const ListElement<type>& element)
{
return this->GetHead() == element ? true : false;
}
template <class type>
bool LinkedList<type>::IsTail(const ListElement<type>& element)
{
return this->GetTail() == element ? true : false;
}
template <class type>
bool LinkedList<type>::IsEmpty()
{
return this->GetSize() == 0 ? true : false;
}
template <class type>
ListElement<type>* LinkedList<type>::GetElementByIndex(int index)
{
int i;
ListElement<type>* pTmp = NULL;
if (this->GetSize() == 0 || index >= this->GetSize())
return pTmp;
pTmp = this->GetHead(); // element zero
for (i = 1; i <= index; i++)
{
pTmp = pTmp->GetNext();
}
return pTmp;
}
template <class type>
LinkedList<type>* LinkedList<type>::Clone()
{
LinkedList<type>* pNewList = NULL;
ListElement<type>* pSrcElement = NULL;
if (this->GetSize() == 0)
return pNewList;
pNewList = new LinkedList<type>;
pSrcElement = this->GetHead();
pNewList->InsertNext(NULL, pSrcElement->CloneData());
while (pSrcElement->GetNext() != NULL)
{
pSrcElement = pSrcElement->GetNext();
pNewList->InsertNext(pNewList->GetTail(), pSrcElement->CloneData());
}
return pNewList;
}
template <class type>
LinkedList<type>* LinkedList<type>::Copy()
{
LinkedList<type>* pNewList = NULL;
ListElement<type>* pSrcElement = NULL;
if (this->GetSize() == 0)
return pNewList;
pNewList = this;
pSrcElement = this->GetHead();
pNewList->InsertNext(NULL, pSrcElement->CloneData());
while (pSrcElement->GetNext() != NULL)
{
pSrcElement = pSrcElement->GetNext();
pNewList->InsertNext(pNewList->GetTail(), pSrcElement->GetData());
}
return pNewList;
}
template <class type>
void LinkedList<type>::FreeData() // only call when data is allocated on the heap
{
ListElement<type>* pElement = NULL;
if (this->GetSize() == 0)
return;
pElement = this->GetHead();
pElement->FreeData();
while (pElement->GetNext() != NULL)
{
pElement = pElement->GetNext();
pElement->FreeData();
}
}
template <class type>
void LinkedList<type>::SetHead(ListElement<type>* pHead)
{
m_pHead = pHead;
}
template <class type>
void LinkedList<type>::SetTail(ListElement<type>* pTail)
{
m_pTail = pTail;
}
template <class type>
void LinkedList<type>::SetSize(int size)
{
m_size = size;
}
/*
*************************
listelement class
*************************
*/
template <class type>
ListElement<type>::ListElement<type>() : m_pData(NULL), m_pNext(NULL)
{
// do nothing
}
template <class type>
ListElement<type>::~ListElement<type>()
{
if (m_pNext != NULL)
delete m_pNext;
}
template <class type>
type* ListElement<type>::GetData()
{
return m_pData;
}
template <class type>
void ListElement<type>::SetData(type* pData)
{
m_pData = pData;
}
template <class type>
void ListElement<type>::FreeData()
{
if (m_pData != NULL)
delete m_pData;
}
template <class type>
ListElement<type>* ListElement<type>::GetNext()
{
return m_pNext;
}
template <class type>
void ListElement<type>::SetNext(ListElement<type>* pNext)
{
m_pNext = pNext;
}
template <class type>
type* ListElement<type>::CloneData()
{
type* pNewData = new type;
*pNewData = *m_pData;
return pNewData;
}
Linking...
main.obj : error LNK2019: unresolved external symbol "public: __thiscall Stack<int,100>::~Stack<int,100>(void)" (??1?$Stack@H$0GE@@@QAE@XZ) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall Stack<double,30>::~Stack<double,30>(void)" (??1?$Stack@N$0BO@@@QAE@XZ) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Stack<int,100>::push(int const &)" (?push@?$Stack@H$0GE@@@QAEXABH@Z) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Stack<double,30>::push(double const &)" (?push@?$Stack@N$0BO@@@QAEXABN@Z) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Stack<int,100>::isEmpty(void)const " (?isEmpty@?$Stack@H$0GE@@@QBE_NXZ) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall Stack<double,30>::Stack<double,30>(void)" (??0?$Stack@N$0BO@@@QAE@XZ) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall Stack<int,100>::Stack<int,100>(void)" (??0?$Stack@H$0GE@@@QAE@XZ) referenced in function "void __cdecl stackfunc(void)" (?stackfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: class LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > * __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Clone(void)" (?Clone@?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAV1@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: class ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > * __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::GetElementByIndex(int)" (?GetElementByIndex@?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAV?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@H@Z) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: class ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > * __thiscall ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::GetNext(void)" (?GetNext@?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAV1@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: class ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > * __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::GetHead(void)" (?GetHead@?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAV?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::GetSize(void)" (?GetSize@?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEHXZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: class ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > * __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::GetTail(void)" (?GetTail@?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAV?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::InsertNext(class ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const *)" (?InsertNext@?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE_NPAV?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * __thiscall ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::GetData(void)" (?GetData@?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::SetData(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?SetData@?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEXPAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::ListElement<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??0?$ListElement@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??0?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@XZ) referenced in function "void __cdecl listfunc(void)" (?listfunc@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::~LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??1?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@XZ) referenced in function "public: void * __thiscall LinkedList<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::`scalar deleting destructor'(unsigned int)" (??_G?$LinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEPAXI@Z)
Debug/list_test.exe : fatal error LNK1120: 19 unresolved externals
list_test - 20 error(s), 2 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
|
|
|
|
|
You might want to use <pre> tags in the future so that code is readable. Does main.cpp include the file linkedlist.h ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
here's a bit of main.cpp:
#include <string>
#include <iostream>
using namespace std;
#include "linkedlist.h"
void listfunc()
{
ListElement<string>* pStrElmt = NULL;
LinkedList<string>* pStrList = new LinkedList<string>;
string sData1("NUMERO UNO!");
string sData2("NUMERO DOS!");
string sData3("NUMERO TRES!");
string sData4("NUMERO QUATRO!");
string sData5("NUMERO CINQO!");
// element 1
pStrElmt = new ListElement<string>;
pStrElmt->SetData(&sData1);
pStrList->InsertNext(NULL, pStrElmt->GetData());
// element 2
pStrElmt = new ListElement<string>;
pStrElmt->SetData(&sData2);
pStrList->InsertNext(pStrList->GetTail(), pStrElmt->GetData());
// etc...
as you can see i've #include'd where needed, & it's compiled fine, but the linker doesn't like it.
|
|
|
|