GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Mar-2010, 19:55
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 265
ahbi82 has a spectacular aura aboutahbi82 has a spectacular aura about

Possible to explicitly create / launch console?


To begin with, i'm designing a framework for debugging / logging / tracing for my system. There are several output options; output streams (RS 232 or http), file (probably txt) and console (more for developers debugging)... etc. The options can be mask to be enabled.

My problem is that how can i explicitly create / launch a console instead of using "main"?

Thanks in advance!
  #2  
Old 09-Mar-2010, 21:04
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 265
ahbi82 has a spectacular aura aboutahbi82 has a spectacular aura about

Re: Possible to explicitly create / launch console?


Anyway i found the solution. To add on, my framework is in DLL.
Solution is to use the windows API "AllocConsole()" when attach to process and "FreeConsole()" when detach process. Just to share this solution if someone has the same problem as me.

Well, i would use this thread to post another question. Sorry to myself if i hijacked this thread.

The problem is about forward declaration of struct nested in a class. I can't seem to get the XXXX to compile.

CPP / C++ / C Code:
// Header file
#ifndef __HDR_H__
#define __HDR_H__

// Forward declaration
struct MyStruct;

class MyClass
{
    public:
        MyClass();
        ~MyClass();

    private:
        MyStruct m_member;

};

#endif // __HDR_H__ 

CPP / C++ / C Code:
// Implementation.
#include "hdr.h"

struct MyStruct
{
    int myInt;
};

MyClass::MyClass()
{
}

MyClass::~MyClass()
{
}



Thanks in advance!
  #3  
Old 10-Mar-2010, 01:23
Kimmo Kimmo is offline
Regular Member
 
Join Date: Mar 2007
Location: Finland
Posts: 388
Kimmo is a jewel in the roughKimmo is a jewel in the roughKimmo is a jewel in the rough

Re: Possible to explicitly create / launch console?


Quote:
Originally Posted by ahbi82
The problem is about forward declaration of struct nested in a class. I can't seem to get the XXXX to compile.
A forward declaration won't suffice in this case. If the compiler cannot see the MyStruct definition, then how could it for example know the size of MyClass? You have to provide the full definition of MyStruct. Also, the "pointer to implementation" (often called "the pimpl") I showed in that one thread of yours can be used in this case, since the compiler knows the size of a pointer to MyStruct without seeing the full MyStruct definition.
 
 

Recent GIDBlogR for statistics by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Java Web Start to Launch NetBeans foxon177 Java Forum 1 15-May-2008 19:30
win32 CreateProcess(), STARTUPINFO not working well for 98 console Howard_L C Programming Language 0 09-Aug-2007 23:33
create array of my class amad1337 Java Forum 4 11-Nov-2006 08:26
need help with a console menu system BullBuchanan C++ Forum 6 20-Aug-2006 14:46
Bloodshed Dev C++ Project Options JdS C++ Forum 6 11-Nov-2005 17:23

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:02.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.