g++

Linking with --whole-archive flag.

Hi, This problem is related to This question I asked yesterday. Now it seems that the linker flag --whole-archive forces the test object to be included in the binary. However, in linking with, g++ main.cpp -o app -Wl,--whole-archive -L/home/dumindara/intest/test.a -Wl,-no--whole-archive I get the following error: /usr/lib64/gcc/x8...

Linker driving me mad! Please help.

Hi, I have 3 tiny files which I use to make a static library and an app: test.h #ifndef TEST_H #define TEST_H class Test { public: Test(); }; extern Test* gpTest; #endif test.cpp #include "test.h" Test::Test() { gpTest = this; } Test test; main.cpp #include "test.h" #include <iostream> using namespace...

Linker question..... again.

Possible Duplicate: ld linker question: the --whole-archive option So, What does this linker flag do? --whole-archive And has anyone had trouble with this? If so how to solve it? Thanks for any help. ...

whole-archive flag doesnt work for me...

Possible Duplicate: Linker driving me mad! Please help. Hi, I have used the --whole-archive flag and it does not have the desired effects. What can I do? Who should I ask? More detailed description here. Please help. Thanks. ...

init_priority attribute on variables in static libs.

Hi, This is a new question after my long rant. The problem here is, I have a global vector<Base*> vObjs in my main application and I got Derived objs in each static lib linked to the application. If I specify the vObjs to have an init_priority of 101 and each obj in static libs to have say... 1000, is it guaranteed that vObjs will ...

ld: duplicate symbol. g++

Ok I'm trying to get my head around g++ and librarys. I have a few files that I've compiled into a library from the make file $(CC) -fPIC -c -o $@ $< -O2 -D__PS2 then $(CC) -shared -o $@ $(OBJ_FILES) -O2 -D__PS2 this compiles fine. from the program that uses the lib $(CC) -c -o $@ $< -I./ compiles fine $(CC) -o $@ $(OBJ_FILES...

porting from linux to windows. mingw

I have a great problem with this porting building usual sdl is simple http://www.libsdl.org/extras/win32/mingw32/README.txt zlib libjpeg libpng giflib libtiff installing was hard but i did then SDL_image install was simple I took my sources from simple lerning project make clean && make g++ compile good at the linking stage hid very...

Can't compile 32bit with 64bit g++

I'm using codeblocks. I'm using ubuntu. Here is output of compilation. g++ -Wall -O2 -m32 -nostdlib -Iinclude -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Component.cpp -o obj/ReleaseCGI32/src/WEBGINE/Component.o g++ -Wall -O2 -m32 -nostdlib -Iinclude -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Debug/ComData.cpp -...

What files are actually included when compiling

Hi, I have a very large code, a lot of which is legacy code. I want to know which of all these files are taking part in the compilation. The code is written in GNU compilers and mostly in C/C++, but some in other programs too. Any advice will be highly appreciated. Thanks, Moshe. I am compiling under linux with a mix of scripts/...

cygwin1.dll missing when compiling c++ with g++

I'm using cygwin and when I'm compiling hello world with gcc somehow the compiler doesn't understand about using std namespaces (some of them are missing), but when I compile with g++ yes they work. But when I click on the helloworld.exe it says that cygwin1.dll is missing. Is there anything can I do? ...

Is there any perf hit using DLL functions?

As the title says, compared to a normal function, is there a perf hit in calling dll functions? The dll will be loaded by dlopen. EDIT: Ignore dlsym time because I only do it once per each function. ...

mingw. how to use static and dynamic linking both

lets make the simpliest application: result: ok. it works. lets add some SDL with default dynamic linking here! result: works great. at stdout.txt we can see "puchuu" lets change our makefile a little. just group 2 object files to the static lib: result: Who is to blame? Me or mingw developers? is it clear to...

C++ in G++ - Segmentation Fault when not using pointers

I'm trying to use G++ to compile some C++ code. It seems to work fine in other compilers, but for whatever reason, G++ won't produce working output. Disclosure: This is part of a homework assignment, but I feel like it's more of a compiler issue, since it works in other compilers. Here's the snippet that's wreaking havoc: set<int> t1,...

how to implement unsigned 33 bit integer type

Is there any way to implement 33 bit unsigned integer for gcc compiler? As of now I am using unsigned 64 bit integer to store 33 bit value. But unfortunately i want the value to be reset after it reaches full 33 bits... ...

Does g++ still generate an output file even if the program fails to compile/load?

I am compiling some C++ programs through a perl script using: g++ -o out `find ./ -iname "*.h" -or -iname "*.cpp"` This seems to generate an an out file every time, regardless of whether the program compiled successfully or not. Whenever the script tries to run programs like this, it gets permission errors (weird since I'm running as ...

c++ cpp conversion from 'myItem*' to non-scalar type 'myItem' requested

i have this code struc MyItem { var value MyItem* nextItem } MyItem item = new MyItem; And I get the error: "c++ cpp conversion from 'myItem*' to non-scalar type 'myItem' requested" Compiling with g++ Any ideas? Thanks! ...

How to use for_each here correctly?

Hi, I am new to all the functional stuff in STL. I tried to do smething but it fails horribly no matter how I try it. Please comment: #include <iostream> #include <algorithm> using namespace std; class X { public: void Print(int x) { cout << x << endl; } void Do() { ...

Linker for Clang?

Which linker do I use for clang? If I use clang or ld as a linker, I get massive amounts of errors as if I didn't link with the standard library. g++ $(OBJS) -o $(BINDIR)/obtap It seems I have to use g++ in order to link my clang objects. ...

std::future exception on gcc experimental implementation of C++0x

Hi all, I'm experimenting with C++0x threading, partially implemented in gcc 4.5 and I've got a problem, which I can't understand. Let's have a look on this code #include <future> #include <iostream> int main() { std::cout << std::async([]() { return 10; }).get() << std::endl; } it's quite simple and should work, but it's no...

optimization of access to members in c++

I'm running into an inconsistent optimization behavior with different compilers for the following code: class tester { public: tester(int* arr_, int sz_) : arr(arr_), sz(sz_) {} int doadd() { sm = 0; for (int n = 0; n < 1000; ++n) { for (int i = 0; i < sz; ++i) { ...