#include "Position.hpp"
int main()
{
Position position(3, 4);
return 0;
}
/*
* Position.hpp
*
* Created on: 30/08/2014
* Author: Romain
*/
#ifndef POSITION_H_
#define POSITION_H_
#include <string>
class Position
{
public:
Position(int _x, int _y);
Position();
Position deltaX(int delta);
Position deltaY(int delta);
Position deltaXY(int deltaX, int deltaY);
int getX();
int getY();
std::string print();
private:
int x;
int y;
};
#endif /* POSITION_H_ */
Thanks for your answer. I have tried it and it works well! :)
I have still another question though: What is the best practice to do that? Create a build target which will generate the librairy and have another build target to generate the .exe file?
Thanks for your answer. I have tried it and it works well! :)
I have still another question though: What is the best practice to do that? Create a build target which will generate the librairy and have another build target to generate the .exe file?
That does not seem right to me.
The source codes of the library and the application are different, and belong in separate projects. The library should be a e.g. a static library project and the application an executable project, each with their own source files. Then declare dependency on the library project and link against the library (in each target).
It is more natural IMHO to use build targets for Debug/Release settings.
For some projects, it is easier to have the Library be just a separate Target.
For some projects, it is easier to have the Library be just a separate Target.
Really? How do you declare dependencies between targets? Can a project reuse a library defined as a Target in another project? How about dependencies in those cases?
QuoteReally? How do you declare dependencies between targets? Can a project reuse a library defined as a Target in another project? How about dependencies in those cases?
Have you ever compiled Code::Blocks (CB) using CB projects to do it?
If not, look at the main CB Project it has at least 3 libraries in it; and, it has multiple executable targets that use them.
Edit1: And, most of the CB Contrib projects use the CB DLL created by the CB Core project!
Edit2: I suggest looking up CB "Virtual targets" and external file dependency as things you need to know about CB to do what I suggested.