How do I build a program using two .ide files in Borland C++ 5.02? - borland-c++

I know how to get the program to build using one, but I'm not quite sure how to do get it to full build using two .IDE files.

Related

Makefile explanation. Understanding someone else's Makefile

I am relatively new to programming on Linux.
I understand that Makefiles are used to ease the compiling process when compiling several files.
Rather than writing "g++ main.cpp x.cpp y.cpp -o executable" everytime you need to compile and run your program, you can throw it into a Makefile and run make in that directory.
I am trying to get a RPi and Arduino to communicate with each other using the nRF24L01 radios using tmrh20's library here. I have been successful using tmrh20's Makefile to build the the executable needed (on the RPi). I would like to, however, use tmrh20's library to build my own executables.
I have watched several tutorial videos on Makefiles but still cannot seem to piece together what is happening in tmrh20's.
The Makefile (1) in question is here. I believe it is somehow referencing a second Makefile (2) (for filenames?) here. (Why is this necessary?)
If it helps anyone understand (it took me a while) I had to build using SPIDEV (the instructions here) the Makefile (3) in the RF24 directory which produced several object files which I think are relevant to Makefile (1)&(2).
How do I find out what files I need to make my own Makefile, from tmrh20's Makefile (if that makes sense?) He seems to use variables in his Makefile that are not defined? Or are perhaps defined elsewhere?
Apologies for my poor explanation.
The canonical sequence is not just make and make install. There is an initial ./configure step (such a file is here) that sets up everything and generates several files used in the make steps.
You only need to run this configure script successfully only once, unless you want to change build parameters. I say "successfully" because the first execution will usually complain that you are missing libraries or header files. But ince ./configure runs without errors, make and make install should run without errors.
PS: I didn't try to compile it, but since the project has a rather comprehensive configure it is likely complete and you shouldn't need to tweak makefiles if your follow the usual procedure.
The reason for splitting the Makefiles in the way you've mentioned and linked to here is to separate the definition of the variables from the implementation. This way you could have multiple base Makefiles that define their PROGRAM variable differently, but all do the same thing based on the value of that variable.
In my own personal opinion, I see some value here - but there very many ways to skin this proverbial cat.
Having learned GNU Make the hard way, I can only recommend you do the same. There's a slight steep curve at the beginning, but once you get the main concepts down following other peoples Makefiles gets pretty easy.
Good luck: https://www.gnu.org/software/make/manual/html_node/index.html

Swift on Linux: how to specify compiler optimizations

Several threads on stackoverflow (e.g. this one) discuss the different optimization levels (Onone, O, Ounchecked...) when compiling Swift applications.
However, those postings are related to the development on OSX. It seems that those optimizations can be set directly via Xcode or xcrun (xcrun swift -O3).
I'm wondering how to switch the different optimization levels when using the Swift compiler directly on Linux (Ubuntu 15.10). Currently, I'm building the application just by invoking swift build as it is shown in the docs, but I found no way no change the optimization level.
It is possible to provide the -O, -Onone, and -Ounchecked optimization flags to the Swift compiler, swiftc. However, it appears that there is currently no way to specify additional flags to swift build. See, for example, the following link, even though it is not directly related:
https://bugs.swift.org/browse/SR-397. The same bug report suggests that the team is actively working on adding this missing functionality.
One way that I found to work around the problem is to run swift build -v, find the first command that references -Onone, copy it and all the commands that follow it to a shell script, edit the script to use the desired optimization level instead of -Onone, and run the script. This should re-compile the Swift sources using the desired optimization level and rebuild the executable.
In my testing I found that a simple example involving sorting an array runs a couple of orders of magnitude faster if built using -O or -Ounchecked instead of -Onone.

Is it possible to use Two different linkers to create an executable file for the code compiled in any Compiler

This is regarding to the linker..
Can I use two different linkers to generate an executable for code compiled for Specific architecture.For Example I am using Tasking as a compiler,after compilation I got an Object files. I want to create a executable for the object files generated from Tasking using any other linker.
Thanks In Advance...
You can run all the compilation steps separately and use different tools for any of them. The process is explained in the following thread:
Running gcc's steps manually, compiling, assembling, linking

AVR Assembler in Linux

I'm trying to learn AVR development in C and Assembly for the Arduino Uno (Atmel 328p microprocessor) in Linux.
I've found many good guides on how to install and setup the AVR plugin for Eclipse, and I've no problem building and uploading C code. However there doesn't seem to be any menu options for creating an assembler project, nor can I seem to find the correct syntax for using the cli avr-as for assembling my programs into a .hex file.
You have a couple choices. I don't know about eclipse, (I just use vim and make directly) but the compilation procedure should be the same.
You can:
Write a mostly C project, in-lining whatever assembly you want. This is usually the easiest method. Check out the AVR-GCC Inline Assembler Cookbook.
Write a purely ASM application that doesn't use the linker at all. e.g. a one-file application (or one file that directly includes the rest of the project explicitly). You'll have to tell your build tool what to do to process the file, but it can be as simple as one invocation of avra or avr-as. You must be sure to carefully do all the low-level initialization and build a complete interrupt vector table for the MCU you're using, or you may get unexpected behavior.
Write a mixed C and ASM application linking between object files from both languages. To do that you do the same thing you would for a pure C project, except some (maybe all) of your source files will need to be assembly. You'll have to tell your build tool how to assemble them in to object files. In a Makefile this would be writing the correct rule (or more likely setting up the ${AS} macro to use the correct assembler). In eclipse there is probably a project setting for it, but with any IDE YMMV. This is probably the hardest option, as you'll have to know the calling convention and ABI of your compiler to successfully execute your pure ASM code.

Generate package config file automagically using Scons, bjam, and/or cmake

Hey Stackoverflowers: one comment and one question.
Comment: You guys/girls are great, thanks for taking a look.
Question:
Can Bjam, Scons, or Cmake easily install a .pc file for library projects?
I find it really annoying that I have to maintain the same library dependency list in my scons/bjam/make file, the .pc file (for libraries), and rpm/deb package config files.
It would be nice if a build tool could manage the build and installation meta-data.
Thoughts?
Because SCons is such a flexible environment, yes you can in fact use it to manage the entire process from building to deliverable package.
Our build goes through several phases with SCons:
Build - resulting .o, .os, generated files, etc under ./build
Assembly - resulting exe, so/dll, binarys, etc under ./delivery
Packing & configuration - a set of deb/rpm/msi + configuration, etc under ./package
It isn't all out of the box, and requires you to write some python code, find tools etc, but it does work for us pretty well.
Our project is C, C++, Java, & Python building dozens of binary targets for a distributed system with multiple delivery targets for different machine installs on Windows, Ubuntu and Redhat Linux.
Again, be prepared to have to customize your scripts and write custom builders though to wrap different processes.

Resources