Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: trafalgrar on October 26, 2007, 07:53:09 pm

Title: One workspace; two projects
Post by: trafalgrar on October 26, 2007, 07:53:09 pm
Hi!
I'd like to have a workspace with two projects. The first one should be a static library [ using C++ language ]. The second should be a normal console application which links the library from the first project. How to prepare such hierarchy? It would be nice if compilation of the second project will be starting a build process of the first one.
Title: Re: One workspace; two projects
Post by: mariocup on October 26, 2007, 10:55:30 pm
Hi trafalgrar,

in CB you can define so called project dependencies in a workspace. So save the projects in a workspace and then go to the project properties and choose project dependencies. This will sove your problem.
Title: Re: One workspace; two projects
Post by: trafalgrar on October 26, 2007, 11:41:06 pm
Project dependencies work good. But what about saving the workspace? When I choose "save workspace" what file extensions should I use? *.cbp doesn't work.
Title: Re: One workspace; two projects
Post by: Jenna on October 26, 2007, 11:50:28 pm
*.workspace
Title: Re: One workspace; two projects
Post by: trafalgrar on October 28, 2007, 11:39:32 am
It seems projects dependencies doesn't work as they are supposed to. For example - Project2 depends on Project1. If I change something in Project1 while Project2 is already built then nothing is going to happen [ CB says everything is up to date ]. I have to build Project1 manually and after that rebuild Project2. It's annoying. How to make it work.
Title: Re: One workspace; two projects
Post by: mariocup on October 28, 2007, 06:46:20 pm
Can you attach a small example?
Title: Re: One workspace; two projects
Post by: trafalgrar on October 28, 2007, 07:48:34 pm
Sure, check an attachment for example workspace.

If I modify main.cpp in the DEP_LIB and if I want to have a new library to be compiled into the DEP_APP, I have to either rebuild the the DEP_APP or rebuild DEP_LIB first and then DEP_APP. In MSVC for example such dependencies work that I need to build [ not rebuild! ] only DEP_APP [ IDE checks all dependant projects if they are up to date ]. CB seems it doesn't check this properly.

[attachment deleted by admin]
Title: Re: One workspace; two projects
Post by: killerbot on October 28, 2007, 10:46:06 pm
last week I had a minor chat with the Don about this, I was gonna experiment with this, since waht I recall was that there were issues, and I think this is an important one to solve, will make CB a real build system then and will be very good for usability since CB then does what most users will expect from it.
Title: Re: One workspace; two projects
Post by: orel on November 02, 2007, 10:39:12 am
To me and for the workspace you uploaded, that works with the expected behaviour.
 I mean before building DEP_APP (modified or not) CB will first look if DEP_LIB is up_to_date, and compile it if it's not.
Config for that : WIN XP SP2, CB (svn 4564), gcc compiler


But i remember having this problem sometimes in the past too.