Eclipse c++ with mingw comiler cant build boost regex example, can find .a library files - eclipse

I'm trying to build the boost regex example in eclipse using mingw on vista.
I built boost ok with mingw as there are library files XXXX.a.
I could build/compile the first boost example that doesnt require any of the compiled boost libraries.
When I compile the regex example I get a linker error saying it cant find the library file.
I have tried various libray file names eg leave off the .a extension, leave off the lib prefix etc.
Now the interesting thing is that if I leave off the library extension and rename the library file to XXX.lib it works and runs ok.
So why cant it read the .a library file?
It must be my setup somewhere but I dont know where or what to set.
From what I read everyone is ok linking the .a file except me :(
Thanks in advance,
Kim

Is this similar to this thread?
I built the stock Hello World with no problems and added a second "utilities" static library project for practice. I did the following:
checked "utilities" as a project reference for Hello World.
added libutilities as as a lbrary to "Hello World" project library list.
added "${workspace_loc:/utilities/Debug}" as the dir path for libs. (libutilities.a lives there). (also tried the "file system" version of this.)
Clean and build results in the following error:
g++ -LC:\projects\fargo\utilities\Debug -ohello_world.exe src\hello_world.o
src\c_template_class.o -llibutilities
C:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
cannot find -llibutilities
collect2: ld returned 1 exit status
To link a library libutilities.a, the command line option should be -lutilities

Related

In Adacore's GPR file, how can I set the compiler include search paths for C++

I have some C++ code that I need to compile using Adacore GNAT Programming Studio.
One file (SomeHeader.h) is in a Common directory (../../Common/) relative to my GPR file.
Our convention for C++ include directives is to use
#include "Common/SomeHeader.h"
No matter what I do, I cannot get GprBuild to find "Common/SomeHeader.h"
I followed the instructions here at AdaGem 108 with modifications for C++
for Include_Switches ("c++") use ("-I ../../");
and
for Include_Path ("c++") use "../..";
None of this seems to work for me during gprbuild and frustratingly I can't seem to get at the backend command that gprbuild is using even after turning the build verbosity up.
I see some temp files in the build messages but they get deleted before I can access them.
I am using Adacore GPS 17.1 on Windows 10 i686-pc-mingw32, GNAT Pro 17.1.
Does anyone know how to get include search paths working in Adacore's Gprbuild?
If you want to use relative paths, and you are dead set on using the -I flag, be aware that the current directory at the time you compile your c++ code it is set to the obj directory configured for grp.
So if the directory you want to include is located at C:\Foo\Bar\src\include\ and your grp obj directory is at C:\Foo\Bar\env\gpr\obj then your relative path will need to use -I..\..\..\src\include
I haven't tried to use gprbuild for compiling C++ source text yet, but I suppose it works more or less like with Ada, where you add the relevant directories to the Source_Dirs attribute:
project Cookie is
for Languages use ("C++");
for Source_Dirs use (".",
"../..");
[...]
end Cookie;

AVR for Xcode 4?

Has anyone had success using xcode 4 as an IDE for AVR microcontrollers? Is it possible to have the same amount of integration as the plugin for eclipse?
Yes. I use Xcode 4 as IDE when writing AVR code.
But it only works as a "wrapper" for the avc-gcc command line tools. I have three Xcode targets in the project: build ("make all": compile only), fuse ("make fuse": program fuses) and flash ("make flash": compile and download to AVR). Just select the appropriate target and hit Cmd-B to build.
There is not much integration. I still have to edit the Makefile to set clock frequency, programmer and device model and fuse values. And if I add more .c files I also have to add the corresponding .o file to the Makefile. But at least I can do it from within Xcode.
I have created a minimal project template that will allow you to create a new AVR project in Xcode. Get the file here http://dl.dropbox.com/u/1194636/AVR_Xcode4_template.zip. Extract the archive and put the Atmel AVR® folder into ~/Library/Developer/Xcode/Templates (you might need to create the Templates folder).
Template from second answer (http://dl.dropbox.com/u/1194636/AVR_Xcode4_template.zip) works fine but with some tweaks.. You have to put these in file "makefile" in the template to be able to include multiple files in the project:
OBJECTS = main.o $(OBJ)
SRC = mynewfile.c
OBJDIR = .
OBJ = $(SRC:%.c=$(OBJDIR)/%.o)
LST = $(SRC:%.c=$(OBJDIR)/%.lst)
in SRC section you need to enter all files that are built in the project (for example mynewfile.c).
One more enhancement is to clear all the obj files from the project, after the linking ... Find the section main.hex in makefile and change rm -f line with following
rm -f main.hex $(OBJ) $(LST) main.o
Other then that, everything stays the same. What i couldnt find out is how i can enable code complete for this template. If anyone knows i would appreciate the help.

Xcode can't find my static library!

Here is the linker error:
i686-apple-darwin10-gcc-4.2.1: /Users/william/Documents/SettingsLibrary/build/Debug-iphonesimulator/libSettingsLibrary.a: No such file or directory
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
A couple of weird things, which may be clues to what is going on:
1) In my "library search paths", I have included the recursive path to the library project:
../SettingsLibrary/**
However, SettingsLibrary builds itself to SettingsLibrary/build/Debug/iphoneos/libSettingsLibrary.a
Meanwhile, based on the error message, the linker appears to be looking in:
SettingsLibrary/build/Debug-iphonesimulator/libSettingsLibrary.a
2) I have included the library project in my main project. When I right click under groups and files, there is an option to include the libSettingsLibrary.a file in my target or not. In at least one other library-using project I have looked at, that checkbox is not there for the .a file.
It's difficult to say what the problem is with your project. Can you check the following in the Groups & File view of the main project:
Does the static library project (SettingsLibrary.xcodeproj) appear as a node below your app (the very first node)?
Does the library file (libSettingsLibrary.a) appear just below?
Does the static library (SettingsLibrary (from SettingsLibrary.xcodeproj) ) appear as a node below the main target (at Targets / YourApp)?
Does the library file (libSettingsLibrary.a) appear just below the node Link Binary With Libraries (in the targets section)?
If not, what's missing?
Furthermore, my Library Search Path is empty. If I look at the command line for the linker, it explicitly contains the full path to the static library (SettingsLibrary/build/Debug/iphoneos/libSettingsLibrary.a in your case).
And the checkbox you mention (right-clicking on the static library project within Groups & Files): I have it as well, but it's not checked.

opengl + glew in Eclipse (for windows)

I'm trying to get glew to work under eclipse (mingw) in windows. Seems as if it is extremely unusual not to use Visual Studio in this context. The install instructions for glew is simply "use the project file in build/vc6/"...
The glew readme also writes:
"If you wish to build GLEW from scratch (update the extension data from
the net or add your own extension information), you need a Unix
environment (including wget, perl, and GNU make). The extension data
is regenerated from the top level source directory with:
make extensions"
In order to get glew to work in eclipse and windows I have to compile it in a unix environment? Is there no other way?
Sure, it would probably be a learning experience to pull that off (if I were to succeed) but I feel that my time is best spent actually working on my project. And even if I did manage to crosscompile everything, would it work in anything but Visual Studio?
Is the whole thing unfeasible and the best solution is to install Visual Studio?
Google haven't been of much help, I feel like I am the only one that has ever attempted to do this (is there a good reason this?).
Well if you still require some flexibility that the VS compiler doesn't always hold, you could try downloading the glew source zip file (on their main sourceforge page). Saying you have to have a Unix environment in order for it to work with eclipse is a huge mistake, as I have it working with MinGW at the moment. Just download the source, extract it, and create/put this batch file into the directory with "Makefile":
#echo on
set SYSTEM=mingw
set GLEW_DEST=C:\...[where you extracted it to]...\glew-1.7.0\usr
path = %PATH%;C:\MinGW\msys\1.0\bin;
make all
make install.all
pause
Change ...[where you extracted it to]... to the path you extracted the downloaded source zip to. Save that and run it, and you should see a "usr" folder containing all the dlls, libs, and headers you'll need. Copy those over to their respective OpenGL counterparts (or just anywhere where you'll be able to specify them in Eclipse later).
Now, in Eclipse, make a new project and at least be sure to include this somewhere:
#ifndef GLEW_STATIC
#define GLEW_STATIC
#endif //GLEW_STATIC
#include <Windows.h>
#include <GL/glew.h>
#include <GL/wglew.h>
If you put the glew headers somewhere besides the OpenGL headers, you may not have to use GL/. Now include the libraries by going into Project->Properties->C/C++ Build->Settings->Tool Settings->MinGW C++ Linker->Libraries and add the following libraries:
glew32
opengl32
glu32
glew32.dll
Add any library search paths you'll need. In my case I just used "C:\MinGW\lib" as a second measure.
Now save all your project files, use Project->Clean..., and build your project. If you don't get any glew errors and your project is prepared you should be able to run it.
Hope that works! It did for me.
Try the following:
Download the Windows 32-bit binary for GLEW here: http://glew.sourceforge.net/index.html
Follow the instruction to link your project to GLEW: http://glew.sourceforge.net/install.html
Make sure your Eclipse is also setup to compile with mingw. (I assume you've done this.)
cout << "Hello world!";

How do I build project files and packages for Borland C++ Builder 5 from the command line?

How do I build Borland C++ project files (bpr) and package files (bpk) from the command line? Project groups (bpg) are apparently make files and can be compile with make. But bpks and bprs are xml based and the Export to Makefile won't compile with make.
If I put a project in a bpg, make can't seem to find any of the files specified in the bpg since they all appear to be relative references. I changed the references to absolutes and make reports:
Fatal: Unable to open makefile
You don't need to directly compile a bpr. Just create a bpk which just includes that single bpr, and you can use make to compile it.
"c:\program files\borland\cbuilder5\bin\make" -B -s -fabc.bpg
If you also have other borland compilers installed, do not call the make.exe from the other compiler.
EDIT: execute the make command in the directory where the bpg and bpr is located.
Using bpr2mak and make works for me just fine, so as Roger said, you need to give details on what errors you're getting. BPK files can also be processed with bpr2mak. I'm using this method to compile a large project with many components, without difficulties.
Perhaps you could give some more information on 'won't compile'.
I.e. What error messages are you getting.
One frequent problem the come up with make is addressed at the following
http://www.delphigroups.info/3/8/36427.html