Lazarus: Can't find unit [unit] used by [program] - pascal

I'm trying to use an external library (wingraph) in a simple program. I have .o and .ppu files. I added the directory that contains them to the list of both "Other Unit Files" and "Include Files" paths under Project->Compiler Options. When building, I still get the error "Can't find unit wingraph used by [program]".
The library is Windows specific and I'm compiling on Windows, too.
What should I do to solve the problem?
Note that I don't have extensive knowledge about Pascal itself nor its tools. I'm just trying to quickly help someone start using the library.

It was the problem of outdated compiler

In future, if this happens make sure any Units used in main units are tagged in the 'uses' section as such:
uses Unit1, Unit2...;

Related

How to Publish/Export wxWidgets Application

newbie here.
Want to ask for any advice on how to Publish/Export, CodeBlocks Application made by using wxWidgets. After some research, i discovered that i should use DLL, or something like that, but since I am really new into it, I am missing the logic on how I should actually implement that. Since CodeBlocks offers wxWidgets and DLL as separate projects. So I am not really sure how to properly combine. Thanks in advance.
If you used wxWidgets as .dll, to get a self-standing package you have to distribute all the requested libraries. The simplest way is just to copy them from their source folder (in your case [wxWidgets root]\lib\gcc_dll) in the same folder as your executable. There could be many of them, but usually only two or three are needed. For simplicity you can copy them all, or you can try repeatedly to start the program, and add each time the library indicated in the error message.
Please note that to distribute your application you will probably want to compile it in Release mode, and consequently you should ship the Release .dlls (i.e. beginning with wx...28_ instead of wx...28d_).

How to install and use open source library on Windows?

I'd like to use open source library on Windows. (ex:Aquila, following http://aquila-dsp.org/articles/iteration-over-wave-file-data-revisited/) But I can't understand anything about "Build System"... Everyone just say like, "Unzip the tar, do configure, make, make file" at Linux, but I want to use them for Windows. There are some several questions.
i) Why do I have to "Install" for just source code? Why can't I use these header files by copying them to the working directory and throw #include ".\aquila\global.h" ??
ii) What are Configuration and Make/Make Install? I can't understand them. I just know that configuration open source with Windows need "CMake", and it is configuration tool... But what it actually does??
iii) Though I've done : cmake, mingw32-make, mingw32-make install... My compiler said "undefined references to ...". What this means and what should I do with them?
You don't need to install for sources. You do need to install for the libraries that get built from that source code and that your code is going to use.
configure is the standard name for the script that does build configuration for the software about to be built. The usual way it is run (and how you will see it mentioned) is ./configure.
make is a build management tool (as the tag here on SO will tell you). One of the most common mechanisms for building code on linux (etc.) is to use the autotools suite which uses the aforementioned configure script to generate build configuration information for use by generated makefiles which make then uses to build the software. make is also the way to run the default build target defined in a makefile (which is often the all target and which usually builds the appropriate library/binary/etc.).
make install is a specific, secondary, invocation of the make tool on the install target which (generally) installs the (in this case previously) built code into an appropriate location (in the autotools/configure universe the default location is generally under /usr/local).
cmake is, again as the SO tag says, a build system that generates configuration files for other build tools (make, VS, etc.). This allows the developers to create the build configuration once and build on multiple platforms/etc. (at least in theory).
If running cmake worked correctly then it should have generated the correct information for whatever target system you told it to use (make or VS or whatever). Assuming that was make that should have allowed mingw32-make to build the software correctly (assuming additionally that mingw32-make is not a distinct cmake target than make). If that is not working correctly then something is still missing from your system (and cmake probably should have caught that).
But to give any more detail you will need to give more detail about what errors you are actually getting and from what command.
(Oh, and on Windows, and especially if you plan on building your software with VS (or some other non-mingw32-make tool) the chances of you needing to run mingw32-make install are incredibly small).
For Windows use cmake or latest ninja.
The process is not simple or straight, but achievable. You need to write CMake configuration.
Building process is not simple and straight, that's why there exists language like Java(that's another thing though)
Rely on CMake build the library, and you will get the Open-Source library for Windows.
You can distribute this as library for Windows systems, distribute and integrate with your own software, include the Open Source library, in either cases, you would have to build it for Windows.
Writing CMake helps, it would be helpful to build for other platforms as well.
Now Question comes: Is there any other way except CMake for Windows Build
Would you love the flavor of writing directly Assembly?
If obviously answer is no, you would have to write CMake and generate sln for MSVC and other compilers.
Just fix some of the errors comes, read the FAQ, Documentation before building an Open Source library. And fix the errors as they lurk through.
It is like handling burning iron, but it pays if you're working on something meaningful. Most of the server libraries are Open Source(e.g. age old Apache httpd). So, think before what you're doing.
There are also not many useful Open Source libraries which you could use in your project, but it's the way to Use the Open Source libraries.

Adding Library to VHDL Project

I am trying to use fixed point numbers in my VHDL project, but I keep having trouble implementing the library (found here http://www.eda-stds.org/fphdl/fixed_pkg_c.vhdl). The error I receive when trying to simulate is this
<ufixed> is not declared
My question is how exactly should a library be implemented so it can be used? As of now I have added it to the project in the IEEE_PROPOSED library, but it is not working. All source code can be found here https://github.com/srohrer32/beamformer/tree/fixed_num, under the hdl folder and libraries folder.
Are you using modelsim? Are you using a project? If not... I find the best way is to first compile the library on its own. Open your modelsim.ini file and make a path to the library. Like this:
lib_test = c:/test/source/lib_test
Finally, compile your own code and make sure you use the -modelsimini switch on vcom modelsim command.
If you are using a project (which I don't like, they are not as flexible) then you can point the project to the library.
More help about modelsim compiling with commands:
http://www.tkt.cs.tut.fi/tools/public/tutorials/mentor/modelsim/getting_started/gsms.html#compiling
Not being an isim user myself, a search through the ISim User Guide implies you need to create a separate project to compile into a library, contrasting with how easy it is to target a library from the command line.
Presumably you'd also need to add the library as a resource in your project. Funny there are no complaints about that yet you have:
library ieee_proposed;
in delay_calculation.vhd, noting that a library declaration simply makes the name available. Somewhere the implementation dependent mapping for the library name to library needs to be made. This by default is in xilinxisim.ini, but I imagine your project management interface allows you to map the library into your project, and isim should know where to look for the library.
Nosing around the user guide may be worthwhile.
In Simulation Steps Overview
User Libraries
Depending upon how you launch ISim, there are different methods
available to add user libraries:
When launching Project Navigator, define the user libraries in the ISE tool. See “Working with VHDL Libraries” in ISE Help for
details.
When using ISim standalone, interactive command mode, or non-interactive mode, set the library mapping file (see Appendix A,
Library Mapping File (xilinxisim.ini) to point to your logical or
physical libraries.
When launching ISim from the PlanAhead tool, define the user libraries in that tool. See the PlanAhead User Guide (UG632) for more
information. Appendix D, Additional Resources, contains a link to the
document.
See Working with VHDL Libraries, see To Create a VHDL Library and To Add Files to a VHDL Library.
(The top level link to ISE Help).
You'd think there'd be a FAQ for those of us apostate - speed reading 'religious' tomes sucks even using Google to find them. Notice the explanations are in terms of menu pull down actions, analogous to command line entry. We're being bitten by what's available on the top menu bar. And when you do manage to add and use a library successfully you'll remember how until someone changes the menus around, and you could of course wonder about documentation lagging.
Presumably what you've tried to do is set up the library mapping for synthesis mode in the ISE GUI, which is straightforward but completely ignored by iSim since it has its own system for managing library mappings. I'm not an iSim user but after looking at the documentation and a little testing it looks like the easiest way to set up a library is from the command line:
# This creates an ieee_proposed directory with a partially compiled object.
vhpcomp --work ieee_proposed=ieee_proposed fixed_pkg_c.vhdl
# Add a mapping from the logical library to the physical path.
# *nix shown. Windows would be similar or just use a text editor.
# <logical name>=<physical path>
echo ieee_proposed=`pwd`/ieee_proposed >> path/to/your/xilinxisim.ini
Make sure the xilinxisim.ini file is visible to iSim and it should pick up the mapping to your compiled library. You should be able to keep running vhpcomp from the parent of ieee_proposed to add more files to the library. You may have to manually copy the system default version to maintain the standard library mappings.

What is happening when you set a compilation path?

I understand it is somehow making a connection so that a compiler when envokes connects a source code to whatever libraries that it needs to.
But what is going on a more technical level, or better put what do I need to know in order to confidentally compile code.
I'm working with C++ and MinGW, and have started to look into build files and stuff for Sublime Text 2 (Have learned mostly under unix, or Java + eclipse so far). But what I don't understand what is adding a compiler to your path do for you?
Do I need to add it for every folder I want to compile from? Or is it system wide? I'm really learning this stuff for the first time, we we're never showed how to set up development environments or even deploy code on other systems.
You probably mean include paths and library paths in the compiler:
include paths: where the compiler will look for headers; and
library paths: where the linker, invoked by the compiler, will look for binary libraries to finish building your project.
If that is the case, look here for a gentle explanation.
Basically, what is happening is that the compiler looks in certain places for symbols defined by the operating system and other libraries installed system-wide.
In addition to those paths, you need to tell the compiler where to find the symbols defined in your own project.
You may also mean something related to installing the compiler itself or configuring the editor to use it.
In that case, what is happening is that you need to tell the build system where to find the executable for the compiler.
Basically, what is probably happening is that your editor wants to know where the compiler is so that it can provide real time feedback on your code. Adding the compiler to the system path will usually, but not always, solve your problem.
In more detail:
A C++ build is a rather complex tool chain, involving determining dependencies, preprocessing, compiling, and linking. There are tools that automate that tool chain, and those tools are in turn wrapped into the functionality of modern IDEs like Eclipse, Visual C++, or Sublime Text 2. You many need to tell your editor where to find the tools it uses to provide you with those services.

Problem with Boost::Asio for C++

For my bachelors thesis, I am implementing a distributed version of an algorithm for factoring large integers (finding the prime factorisation). This has applications in e.g. security of the RSA cryptosystem.
My vision is, that clients (linux or windows) will download an application and compute some numbers (these are independant, thus suited for parallelization). The numbers (not found very often), will be sent to a master server, to collect these numbers. Once enough numbers have been collected by the master server, it will do the rest of the computation, which cannot be easily parallelized.
Anyhow, to the technicalities. I was thinking to use Boost::Asio to do a socket client/server implementation, for the clients communication with the master server. Since I want to compile for both linux and windows, I thought windows would be as good a place to start as any. So I downloaded the Boost library and compiled it, as it said on the Boost Getting Started page:
bootstrap
.\bjam
It all compiled just fine. Then I try to compile one of the tutorial examples, client.cpp, from Asio, found (here.. edit: cant post link because of restrictions). I am using the Visual C++ compiler from Microsoft Visual Studio 2008, like this:
cl /EHsc /I D:\Downloads\boost_1_42_0 client.cpp
But I get this error:
/out:client.exe
client.obj
LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-s-1_42.lib'
Anyone have any idea what could be wrong, or how I could move forward? I have been trying pretty much all week, to get a simple client/server socket program for c++ working, but with no luck. Serious frustration kicking in.
Thank you in advance.
The reason the build is failing is because it cannot find the library file containing boost system. Boost includes a "handy" autolinking feature, such that when you include a header file for a binary libaray (as opposed to a header only library), boost automatically tells the compiler that it should link in the library. The downside to this is that boost doesn't tell the compiler where to find the library.
The short answer is to read a little further in the boost getting started guide. This page shows you how to add the necessary flags to the compiler command line: Getting started on windows: linking from the command line.
The first thing you have to do is find the .lib file. Boost hides them in a deep directory structure, so search for it starting in the directory you ran bjam from. Make note of the directory where the file is. You may also wish to use bootstrap --prefix=/some/install/location and bjam install to install boost somewhere other than the source directory in which you built it.
Are you building your project using a Visual Studio solution, or on the command line?
If you are using a solution file, find the link page in the solution properties. There should be a box where you can enter additional library paths. Add the directory in which you boost .lib files reside to this box.
If you are using cl on the command link, familiarize yourself with the command line options for cl and link. You can pass commands to the linker using the cl option /link, and the linker command you are looking for is /libpath.

Resources