Hi folks:
I have a question: How to compile a static library in linux with gcc, i.e. I need to compile my source code into a file named out.a. Is it sufficient to simply compile with the command gcc -o out.a out.c? I'm not quite familiar with gcc, hope anyone can give me a hand. Thanks
Regards.
...
So I've installed iPhone-gcc, make and ldid from cydia, i can't compile
yet though because I don't have the headers setup. I've looked around and there's not really much info on setting up the headers, librarys and frameworks. I just need to know where to extract them from the sdk and where to place them on my iPhone.
I've been trying t...
I'm porting an existing system from Windows to Linux. The build is structured with multiple static libraries. I ran into a linking error where a symbol (defined in libA) could not be found in an object from libB. The linker line looked like
g++ test_obj.o -lA -lB -o test
The problem of course being that by the time the linker finds it ...
Hello
How can I demonstrate for students the usability of likely and unlikely compiler hints (__builtin_expect)?
Can you write an sample code, which will be several times faster with these hints comparing the code without hints.
...
We have a body of C++ code which is being ported from a RHEL4-based distro to RHEL-5-based.
It used to compile with g++ 3.4.3, and now compiles with g++ 4.1.2.
It turns out that there are local POD variables that are being used uninitialized, which is causing
failures under the new environment -- not surprising, since C++ rules say that ...
I'm building an open source 2D game engine called YoghurtGum. Right now I'm working on the Android port, using the NDK provided by Google.
I was going mad because of the errors I was getting in my application, so I made a simple test program:
class Base
{
public:
Base() { }
virtual ~Base() { }
}; // class Base
class Vehic...
This is my code.
struct Vector
{
float x, y, z, w;
};
typedef struct Vector Vector;
inline void inv(Vector* target)
{
(*target).x = -(*target).x;
(*target).y = -(*target).y;
(*target).z = -(*target).z;
(*target).w = -(*target).w;
}
I'm using GCC for ARM (iPhone). Can this be vectorized?
PS: I'm trying some kind of optimization...
I can initialize float32x4_t like this:
const float32x4x4_t zero = { 0.0f, 0.0f, 0.0f, 0.0f };
But this code makes an error Incompatible types in initializer:
const float32x4x4_t one =
{
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
};
float32x4x4_t is 4x4 matrix bui...
cl : Command line warning D9002 : ignoring unknown option '-mwindows'
Seems -mwindows is only for gcc, does cl has a similar option?
...
I'm using GCC on Windows7 (using the TDM's build). I installed MSYS to be able to execute make and compile using makefiles. However, it is tedious to every time start up the MSYS bash shell, navigate to the directory of the project and run make.
What I want is to automate this process. I prefer to have a batch file in Windows, or someth...
I have do an extensive calculation on a big vector of integers. The vector size is not changed during the calculation. The size of the vector is frequently accessed by the code. What is faster in general: using the vector::size() function or using helper constant vectorSize storing the size of the vector?
I know that compilers usually a...
I was wondering which is the default memory allocator in G++ 4.4.1, on Ubuntu 9.1. I am interested in comparing different C++ allocators in a multithreaded environment. And where can I get more information about the default memory allocator?
EDIT: I refer to new and delete operators. The only linking is to rt and pthread
Regards
...
Just curious. Using gcc/gdb under Ubuntu 9.10.
Reading a C book that also often gives the disassembly of the object file. When reading in January, my disassembly looks a lot like the book's; now, it's quite different - possibly more optimized (I notice some re-arrangements in the assembly code now that, at least in the files I checked, ...
I am compiling a kernel module, containing a structure of size 34, using the standard command.
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
The sizeof(some_structure) is coming as 36 instead of 34 i.e. the compiler is padding the structure.
How do I remove this padding?
Running make V=1 shows the gcc compiler options pas...
When compiling our project, we create several archives (static libraries), say liby.a and libz.a that each contains an object file defining a function y_function() and z_function(). Then, these archives are joined in a shared object, say libyz.so, that is one of our main distributable target.
g++ -fPIC -c -o y.o y.cpp
ar cr liby.a y.o...
Can I install an older version of gcc/g++ (4.1.3) on the latest Ubuntu (which comes with 4.4.3) and use it to compile a .so which should run on CentOS? The binary compiled with the Ubuntu version of gcc fails to load on CentOS because of missing imports (GLIB_2_11, ...). I need C++ (including exceptions), so I can't just statically link ...
i tried making library with
ar -r -c -s libtestlib.a *.o
as given in this tutorial http://matrixprogramming.com/Tools/CompileLink.html
But on linking with library following error comes
g++ -o uni2asc uni2asc.o -L../Modules -ltestlib
../Modules/libtestlib.a: could not read symbols: Archive has no index; run ranlib to add one
collect...
I try to build an application which uses pthreads and __m128 SSE type. According to GCC manual, default stack alignment is 16 bytes. In order to use __m128, the requirement is the 16-byte alignment.
My target CPU supports SSE. I use a GCC compiler which doesn't support runtime stack realignment (e.g. -mstackrealign). I cannot use any ot...
I was trying to get error messages in spanish. I have changed the locale to es_EC.utf8 ....
i get messages in spanish when I run apt-get etc.. but gcc gives me errors in english..can anybody help me?
I'm using ubuntu10.04 gcc-4.3.4
...
Is there a way for GCC to produce a warning while linking libraries that contain classes with the same name? For example
Port.h
class Port {
public:
std::string me();
};
Port.cpp
#include "Port.h"
std::string Port::me() { return "Port"; }
FakePort.h
class Port {
public:
std::string me();
};
FakePort.cpp
#include "FakePort....