Author Topic: Include problem/confusion  (Read 3806 times)

jonashn

  • Guest
Include problem/confusion
« on: October 28, 2007, 07:15:23 pm »
Dear C::B users/devs  :)

First i must say that i'm very impressed with Code::Blocks. I started using C::B for wxWidgets developement, but switched to wxDev-Cpp. But wxDev-Cpp crashed about 20 times per hour, so i went to the C::B nightly builds forum and downloaded the lastest nightly build with new Dll's and so on. WHOOAA it's nice :)! Very nice "new project guide" and user interface. And wxSmith is incredibly well made compared to wxDev-Cpp's.

I'm working on a chat app (see http://wxforum.shadonet.com/viewtopic.php?p=72278), and decided to post this problem in a second post.

I've decided to code the IM part of the app as a class library, which contains the imCtrl class.

But i have to #include it both from chatApp.h and chatMain.h, and when compiling it compiles fine, and despite my inclusion guards it comes up with 24 linker errors ala "Multiple definition of blabla".
By searching various forums it appears that the problem is that chatApp and ChatMain are two different files, they are not #included from a base file or from one another.

So what do you recommend me to do to fix this problem?

PS: If i have a project consisting of the standard header, cpp and rc files, and i want to merge everything exept the .rc into one .cpp file, is it then enough to edit the .cbp file?

Offline Auria

  • Almost regular
  • **
  • Posts: 152
Re: Include problem/confusion
« Reply #1 on: October 28, 2007, 08:14:12 pm »
It may be because you declare variables in you header - anyway we may need to see files to tell, or at least know what symbols it is.

Anyway, the Code::Blocks forum is usually reserved exclusively for questions related to C::B itself ( because the C::B devs are not able to moderate a huge amount of posts on the forums, and IIRC could be held legaly liable for something said on their forums that they didn't have time to moderate :( ) try asking on a general C++ forum

jonashn

  • Guest
Re: Include problem/confusion
« Reply #2 on: October 29, 2007, 03:54:00 pm »
I just asked one of the devs if i was allowed to post progamming questions.

But i thought that the xApp.cpp, xApp.h and so on were a .cpp and headerfile-implementation specific to C::B, and that's why i thought it was ok to post in this forum. But now i know better.

I've attached the whole project. When looking at the code, please keep in mind that the project is just begun, and i've not implemented any functionality yet.

[attachment deleted by admin]