New to Linux based programming
Members - Reputation: 1062
Posted 04 May 2011 - 03:03 PM
Members - Reputation: 240
Posted 04 May 2011 - 04:42 PM
g++ -o ProgramName (source files) main.cpp engine.cpp camera.cpp (then linker flags) -lGL -lsfml-window -lsfml-graphics
Then once you know how to compile your own projects on the command line, you can start making scripts or makefiles (I personally like scripts better). Now here is a small tutorial on how I make a script.
1. Open up terminal
2. go to project directory // My directories usually dont have IDE project files in them, just souce and media.
3. type "vi (or any other text editor) m.sh" //This is where you start editing you script
4. type your commands you wish to execute. Ex. g++ -o MyProgram main.cpp // This is where you fill you script with commands.
6. type "chmod +x m.sh" //You change the file to be executable
7. type "./m.sh" //This will compile your project
Now if you would like to use a makefile I think its pretty close. Just look up some tutorials about makefiles if you would like to learn about those.
Members - Reputation: 371
Posted 04 May 2011 - 11:54 PM
However, very few serious projects use Makefiles directly. It is more common to use higher-level tools like the autotools (autoconf/automake) or CMake. Especially CMake is fairly simple to set up, and you basically only specify a list of your source files. CMake will take care of setting up the proper Makefiles, including header dependencies and all that.
Members - Reputation: 1888
Posted 05 May 2011 - 12:07 AM
In the end, it outputs a makefile or project file of your choice, that you can build in the regular way on linux, so you end up with something like:
cmake ./ && make && make install
But it also spits out Visual Studio project files if you take it over to windows.
Members - Reputation: 1215
Posted 05 May 2011 - 02:50 AM
I think you may have slightly misunderstood what make is for. Make isn't a tool to use in your applications -- it's a build tool. The makefile describes how to compile files into other files, how to join multiple files into files and how which files depend on other files. Make then "solves" that graph building the elements as it goes.
If that's not the case, then could you elaborate a little more on what you're trying to build.
Members - Reputation: 1062
Posted 08 May 2011 - 06:25 PM
1. Create a simple makefile based command line application.
**It implements two passive event driven state machines with a main loop to drive them.
**Passive meaning neither block execution of the other for a prolonged period of time.
**Main loop should periodically call into each state machine to give each a chance to run with each state machine returning to the main loop as quickly as possible.
I left out the programming part as I already know how to do that, I just don't understand this makefile part of it. Anyone else able to elaborate on the exact meaning of this cause above is word for word.
Members - Reputation: 309
Posted 10 May 2011 - 07:53 AM
make is a build system. It will build your project for you. It doesn't care if it's an event-driven state machine or the embedded code for one of those automated kitty litter boxes.
Anyway, there's ample information on the internet about how to use make. Use google.
Crossbones+ - Reputation: 4104
Posted 10 May 2011 - 08:14 AM
two_machines_one_cup: machine1.o machine2.o main.o $(CC) -o $@ $^That says "the executable program two_machines_one_cup out of the compiled object files machine1.o, machine2.o, and main.o ... use your implicit rules to generate those .o files from whatever you find in the current directory, like maybe main.cpp, machine1.for, and machine2.mm." The rest is dark and unspeakable magic that can be revealed to uninitiated by the evil incantation "info make".
Professional Free Software Developer