Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
Y

Ylis

@Ylis
About
Posts
28
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Class x needs defining before class y, circular dependecy
    Y Ylis

    Okay, I'l try my best to describe the problem more precisely. Before I go into further details, this is an implementation of a scene graph holding a quad tree, something used in graphics programming in order to arrange elements in space to avoid sending unnecesary data to the graphics card. First of all there's CScene, which represents the scene graph. CScene holds a tree of nodes and functionality for inserting in that tree and manipulating it. Since this tree can hold a lot of diffrent types of nodes, I need to just define a very loose interface for the minimum required functionality of a node that needs to be implemented ( such as Update, Render, AddChild etc ). That interface is called CNodeInterface. When CScene is created it will create the upper elements of the tree with CQuads, this is to create the quad tree. This is how it could look for example:

    ROOT
    |
    |---Quad 1
    | |
    | |---Quad 1.1
    | |
    | |---Player
    | |
    | |---Sword
    |
    |---Quad 2
    |---Quad 3
    |---Quad 4
    |

    In order to save space I've left out nodes under Quad 2, 3 and 4 as well as 3 sub quads under Quad 1. Player and Sword implements CNodeInterface. Thankful for any help :)

    C / C++ / MFC help csharp visual-studio design

  • Class x needs defining before class y, circular dependecy
    Y Ylis

    CScene is a scene graph. CNodeInterface is an abstract class that defines the interface for nodes in the scene graph. CQuad in turn is a type of node that lies at the top of the scene graph and creates a quad tree for sub nodes that later on implements CNodeInterface lies in.

    C / C++ / MFC help csharp visual-studio design

  • Class x needs defining before class y, circular dependecy
    Y Ylis

    Yupp, and I'm still geting the same compilation error :(

    C / C++ / MFC help csharp visual-studio design

  • Class x needs defining before class y, circular dependecy
    Y Ylis

    Okay, I'l try my best to describe the problem at hand. This is what the relations looks like:

    CQuad :
    implements CNodeInterface

    CNodeInterface :
    knows of CScene

    CScene:
    knows of CQuad
    knows of CNodeInterface

    I have some nasty circular dependency here, I know, but I can't seem to design it away. Anyway, the problem is that CNodeInterface needs to be defined before CQuad gets defined, however no matter how I tinker I can't seem to get this to happen. With forward declarations I still get errors in CQuad that CNodeInterface is undefined. Part of the problem is that I don't even know what decides which gets defined first when there's circular dependency. I'm using Visual Studio 2005. Any help appreciated.

    C / C++ / MFC help csharp visual-studio design

  • help me!!!
    Y Ylis

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeInteropServicesDllImportAttributeClassTopic.asp[^] take a look at that :)

    C / C++ / MFC c++ csharp help tutorial workspace

  • mergesort
    Y Ylis

    I'm trying to implement mergesort in C++ but I've grown blind to my code and can't seem to spot the error. It sorts my vector partly, but not entirely. Anyway here's the relevant code: void merge_sort( std::vector &d, int lb, int ub ) { if( lb < ub ) { int q = ( lb + ub ) / 2; merge_sort( d, lb, q ); merge_sort( d, q + 1, ub ); merge( d, lb, q, ub ); } } void merge( std::vector &d, int lb, int sp, int ub ) { int l1 = sp - lb; int l2 = ub - sp; std::vector vL(d.begin() + lb ,d.begin() + lb + l1); std::vector vR(d.begin() + sp , d.begin() + sp + l2); vL.push_back(INT_MAX); vR.push_back(INT_MAX); int i = 0; int j = 0; for( int k = lb; k < ub; k++ ) { if( vL[i] < vR[j] ) d[k] = vL[i++]; else d[k] = vR[j++]; } } Any help appriciated :)

    C / C++ / MFC help c++ sharepoint graphics

  • templates with a nice unresolved external
    Y Ylis

    Thanks! :)

    C / C++ / MFC csharp c++ help visual-studio wpf

  • templates with a nice unresolved external
    Y Ylis

    I'm trying to understand templates and has therefor tried to make a linked list. The code is probably full of more errors but the one I can't seem to find now relates to an unresolved external. I don't have much experience with C++ in general so it could be something really basic. I use Visual Studio 2003 .NET and this is the code: LList.h #ifndef LIST_H_ #define LIST_H_ template< class T > class Element { public: Element *next; Element *previous; T data; void Remove(); }; template< class T > class LList { public: LList(); T& operator []( int p_elem ); void Add( T p_data ); protected: int m_noElems; Element< T > m_elements; }; #endif LList.cpp #include "list.h" template< class T > void Element< T >::Remove() { if( this->previous != NULL ) this->previous->next = this->next; if( this->next != NULL ) this->next->previous = this->previous; delete this; } template< class T > LList< T >::List() { m_noElems = 0; } template< class T > T& LList< T >::operator []( int p_elem ) { if( p_elem > m_noElems ) return NULL; Element< T > *curEle; for( int i = 0; i < p_elem; i++ ) curEle = m_elements.next; return curEle->data; } template< class T > void LList< T >::Add( T p_data ) { Element< T > *curEle; for( int i = 0: i < m_noElems; i++ ) curEle = m_elements.next; curEle->next = new Element; curEle->next->next = NULL; curEle->next->previous = curEle; curEle->next->data = p_data; m_noElems++; } main.cpp #include "list.h" int main() { LList< int > test; } error: list error LNK2019: unresolved external symbol "public: __thiscall LList::LList(void)" (??0?$LList@H@@QAE@XZ) referenced in function _main Any help appriciated! :)

    C / C++ / MFC csharp c++ help visual-studio wpf

  • Syntax error: identifier 'x' when 2 headers include each other
    Y Ylis

    thx :-D

    C / C++ / MFC csharp help visual-studio

  • Syntax error: identifier 'x' when 2 headers include each other
    Y Ylis

    I have 2 classes, and both classes needs to know of each other. Here's the headers: sprite.h #ifndef SPRITE_H #define SPRITE_H #include "SDL.h" #include "SDLgraphics.h" class sprite { public: sprite( char * p_path, int p_noFrames ); void Animate( SDLgraphics &p_g ); SDL_Surface* GetSurface() { return m_image; } SDL_Rect* GetRect() { return &m_image->clip_rect; } protected: float m_x, m_y; int m_noFrames; int m_curFrame; SDL_Surface* m_image; }; #endif SDLgraphics.h #ifndef SDLgraphics_H #define SDLgraphics_H #include #include #include "SDL.h" #include "sprite.h" class SDLgraphics { public: SDLgraphics(unsigned int p_flags); void Init(int p_width, int p_height); void Draw(sprite *p_sprite, SDL_Rect *p_area); inline void Draw(sprite *p_sprite); void Flip(); protected: SDL_Surface *m_scene; }; #endif When I try to compile it in Visual Studio 7.0 .NET I get error C2061: syntax error : identifier 'SDLgraphics', and another one relating to sprite. Greatful for any help :-D;P

    C / C++ / MFC csharp help visual-studio

  • windows program in background and simulate keyboard
    Y Ylis

    oki, thx :)

    C / C++ / MFC question

  • windows program in background and simulate keyboard
    Y Ylis

    1. When I create a windows program and don't have it in focus it seems to end proccessing. This is where I place my code: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } //my code here } Is there anyway I can make sure that my program is being run all the time, even if it's not in focus? 2. My second question is about simulating the keyboard, I know about PostMessage(). However, with this function I must post a key press to a certain window, what I want to do is to simulate a keypress to windows. ;P //Ylis

    C / C++ / MFC question

  • problems with static members
    Y Ylis

    oki, I checked out the cputicker class but still can't figure out what I'm doing wrong, perhaps I'm geting blind to my code. This is what my 2 files looks like now: Timer.h #ifndef TIMER_H #define TIMER_H class Timer { protected: static LARGE_INTEGER m_lTicksPerSecond; static LARGE_INTEGER m_lTime; static LARGE_INTEGER m_lFirstTime; Timer(); public: static bool Initialize(); static double MsSinceStart(); }; #endif and this is what Timer.cpp looks like: #include "Timer.h" LARGE_INTEGER Timer::m_lTicksPerSecond = NULL; LARGE_INTEGER Timer::m_lFirstTime = NULL; LARGE_INTEGER Timer::m_lTime = NULL; bool Timer::Initialize() { if(QueryPerformanceFrequency(&m_lTicksPerSecond) && QueryPerformanceCounter(&m_lFirstTime)) return true; return false; } double Timer::MsSinceStart() { QueryPerformanceCounter(&m_lTime); return ((double)( m_lTime.QuadPart - m_lFirstTime.QuadPart ) / (double) m_lTicksPerSecond.QuadPart ) * 1000.0; } and this is the error which seems relevant: error C2039: 'm_lFirstTime' : is not a member of 'Timer' (which it as you see is) hehe, plz bare with me ;P

    C / C++ / MFC help csharp html question

  • problems with static members
    Y Ylis

    I'm sorry but I can't get it to work :/ When I place LARGE_INTEGER Timer::m_lTime etc inside my .cpp file it begins to talk about redefinition errors. If I remove LARGE_INTEGER m_lTime etc from my .h file it says 'm_lTime' : is not a member of 'Timer'. could you write just a simple class with a static member explaining it to me? :)

    C / C++ / MFC help csharp html question

  • problems with static members
    Y Ylis

    I'm having some trouble with static members in my program. This is what my code looks like: #ifndef TIMER_H #define TIMER_H class Timer { private: static LARGE_INTEGER m_lTicksPerSecond; static LARGE_INTEGER m_lTime; static LARGE_INTEGER m_lFirstTime; Timer(); public: static bool Initialize() { if(QueryPerformanceFrequency(&m_lTicksPerSecond) && QueryPerformanceCounter(&m_lFirstTime)) return true; return false; } static double MsSinceStart() { QueryPerformanceCounter(&m_lTime); return ((double)(m_lTime.QuadPart - m_lFirstTime.QuadPart ) / (double)m_lTicksPerSecond.QuadPart ) * 1000.0; } }; #endif Or you can check it out at http://www.rafb.net/paste/results/SD400728.html (don't know if codeproject supports the formating). Anyway, the error I'm geting is: error LNK2001: unresolved external symbol "private: static union _LARGE_INTEGER Timer::m_lFirstTime" (?m_lFirstTime@Timer@@0T_LARGE_INTEGER@@A) on every member. The program it self is a win32 application. Grateful for any help ;)

    C / C++ / MFC help csharp html question

  • just a small syntax question
    Y Ylis

    I use VS.net 2003 and have vector included. What you suggested seems to work though, thx a lot :)

    C / C++ / MFC help wpf graphics question

  • just a small syntax question
    Y Ylis

    I have a question about the syntax when it comes to templates. What I want to do is to create a pointer to a std::vector which contains pointers to a class called Square. I thought it would look like: std::vector< Square* >*, but obviously my compiler thinks not and gives me "error C2059: syntax error : '>'". Any help appriacted :)

    C / C++ / MFC help wpf graphics question

  • How to setup DX projects
    Y Ylis

    I downloaded the DXSDK and what I started out to do was trying to get the samples to compile. So I enter Samples\C++\Direct3D and pick a random sample. I then open up the .sln file with VS .NET 2003 which pops up an question about if I want to convert the project. A question where I of course pick yes. Everything works fine so far and after some reading I of course want to compile the thing to see what it looks like. After hiting F5 and waiting for a few secs it complains about not finding d3dx9.h. Fine, probably some include missing so I take a look at the includes and add the path to d3dx9.h. After another compile it complains about a lib, which I remedy by including the path to the libs as well. On the third compile I get LNK1104, which means a file couldn't be opened, namely d3dx9dt.lib. The file do exist in the supplied lib path though. So naturaly what I'm asking for is a way to get this thing to work :)

    C / C++ / MFC csharp c++ visual-studio tutorial question

  • using a resource file as main window
    Y Ylis

    is it possible to hack togheter a dialog in a resource designer and then use it as the main window? CreatwWindowEx() doesn't seem to accept a resource and I've tried using CreateDialog() but can't seem to create the dialog as the main window. :)

    C / C++ / MFC question learning

  • Keyboard hook + C# problem
    Y Ylis

    The message arrives so I don't think it has anything to do with the thread id. But I will take a closer look :).

    C# help csharp learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups