Search Results

Search found 2220 results on 89 pages for 'gcc'.

Page 7/89 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • GCC: Simple inheritance test fails

    - by knight666
    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 Vehicle : virtual public Base { public: Vehicle() : Base() { } ~Vehicle() { } }; // class Vehicle class Car : public Vehicle { public: Car() : Base(), Vehicle() { } ~Car() { } }; // class Car int main(int a_Data, char** argv) { Car* stupid = new Car(); return 0; } Seems easy enough, right? Here's how I compile it, which is the same way I compile the rest of my code: /home/oem/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-g++ -g -std=c99 -Wall -Werror -O2 -w -shared -fshort-enums -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -I /home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/include -c src/Inheritance.cpp -o intermediate/Inheritance.o (Line breaks are added for clarity). This compiles fine. But then we get to the linker: /home/oem/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc -lstdc++ -Wl, --entry=main, -rpath-link=/system/lib, -rpath-link=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib, -dynamic-linker=/system/bin/linker, -L/home/oem/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0, -L/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib, -rpath=../../YoghurtGum/lib/GLES -nostdlib -lm -lc -lGLESv1_CM -z /home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib/crtbegin_dynamic.o /home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib/crtend_android.o intermediate/Inheritance.o ../../YoghurtGum/bin/YoghurtGum.a -o bin/Galaxians.android As you can probably tell, there's a lot of cruft in there that isn't really needed. That's because it doesn't work. It fails with the following errors: intermediate/Inheritance.o:(.rodata._ZTI3Car[typeinfo for Car]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' intermediate/Inheritance.o:(.rodata._ZTI7Vehicle[typeinfo for Vehicle]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' intermediate/Inheritance.o:(.rodata._ZTI4Base[typeinfo for Base]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' collect2: ld returned 1 exit status make: *** [bin/Galaxians.android] Fout 1 These are the same errors I get from my actual application. If someone could explain to me where I went wrong in my test or what option or I forgot in my linker, I would be very, extremely grateful. Thanks in advance. UPDATE: When I make my destructors non-inlined, I get new and more exciting link errors: intermediate/Inheritance.o:(.rodata+0x78): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' intermediate/Inheritance.o:(.rodata+0x90): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' intermediate/Inheritance.o:(.rodata+0xb0): undefined reference to `vtable for __cxxabiv1::__class_type_info' collect2: ld returned 1 exit status make: *** [bin/Galaxians.android] Fout 1

    Read the article

  • gcc memory alignment pragma

    - by aaa
    hello. Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I would like to tell compiler to optimize particular loop using aligned loads/store instructions. Thanks

    Read the article

  • gcc segmentation fault compiling 20k file

    - by aaa
    hi. I have fairly large file, 20k lines long (auto generated). It has been compiling okay, but after adding new if/endif preprocessor block, I started getting gcc internal errors: segmentation fault. the code inside new preprocessor block is not being compiled, so I am not sure where the error is coming from. my only guess is memory, but as far as I can tell it does not exhaust computer memory. Any thoughts?

    Read the article

  • How to manually throw a compiler error in GCC and Xcode

    - by coneybeare
    In xcode, while compiling apps with gcc, I want to throw compilation time errors if things like NSZombieEnabled is on for a distribution release, thus ensuring that compilation will fail and I won't accidentally do something stupid. I did some googling, but could not figure out how to cause the compiler to bail if a certain condition is met. Surely it must be easy, am I just not finding it?

    Read the article

  • Link User32 with gcc

    - by Tim Cooper
    I have a C program which has a function call that is defined in windows.h (which I have included), however, when I try and compile it with gcc, I get the error: warning: implicit declaration of function `LockWorkStation' I looked at the MSDN documentation and I see that this function is the User32 library file, and I was wondering how I would go about linking that to my file.

    Read the article

  • Weird gcc error stray/missing terminating " character in C

    - by DreamCodeR
    I get the following errors: error: missing terminating " character and error: stray `\' in program In this line of C code: system("sqlite3 -html /home/user/.rtcom-eventlogger/el.db \"SELECT service_id, event_type_id,free_text, remote_uid FROM Events WHERE remote_uid=\'%d\' ORDER BY start_time DESC;\" > lol.html", nr); "nr" is a integer variable. I have gone over this so many times but are totally stuck of finding a solution. EDIT: The errors is the ouput while compiling with gcc if I didn't make that clear.

    Read the article

  • Can nullptr be emulated in gcc?

    - by nuzz
    I saw that nullptr was implemented in Visual Studio 2010. I like the concept and want to start using it as soon as possible; however GCC does not support it yet. My code needs to run on both (but doesn't have to compile with other compilers). Is there a way to "emulate" it? Something like: #define nullptr NULL (but obviously that wouldn't work well at all, I was simply showing what I meant).

    Read the article

  • Is there dependency generation flag for MSVC like gcc's -M

    - by Artyom
    Hello, Is there dependency generation flag for MSVC like gcc's -M flag. Every C++ compiler I have ever used had this kind of flag. How can I create dependencies automatically with MSVC cl compiler. I'm interested for only latest compiler versions i.e. MSVC9 or later but if it works with MSVC8 it is fine as well. If there is built-in external tool to do this (I mean, not cl), it would be fine as well

    Read the article

  • Strange behavior with gcc inline assembly

    - by Chris
    When inlining assembly in gcc, I find myself regularly having to add empty asm blocks in order to keep variables alive in earlier blocks, for example: asm("rcr $1,%[borrow];" "movq 0(%[b_],%[i],8),%%rax;" "adcq %%rax,0(%[r_top],%[i],8);" "rcl $1,%[borrow];" : [borrow]"+r"(borrow) : [i]"r"(i),[b_]"r"(b_.data),[r_top]"r"(r_top.data) : "%rax","%rdx"); asm("" : : "r"(borrow) : ); // work-around to keep borrow alive ... Another example of weirdness is that the code below works great without optimizations, but with -O3 it seg-faults: ulong carry = 0,hi = 0,qh = s.data[1],ql = s.data[0]; asm("movq 0(%[b]),%%rax;" "mulq %[ql];" "movq %%rax,0(%[sb]);" "movq %%rdx,%[hi];" : [hi]"=r"(hi) : [ql]"r"(ql),[b]"r"(b.data),[sb]"r"(sb.data) : "%rax","%rdx","memory"); for (long i = 1; i < b.size; i++) { asm("movq 0(%[b],%[i],8),%%rax;" "mulq %[ql];" "xorq %%r10,%%r10;" "addq %%rax,%[hi];" "adcq %%rdx,%[carry];" "adcq $0,%%r10;" "movq -8(%[b],%[i],8),%%rax;" "mulq %[qh];" "addq %%rax,%[hi];" "adcq %%rdx,%[carry];" "adcq $0,%%r10;" "movq %[hi],0(%[sb],%[i],8);" "movq %[carry],%[hi];" "movq %%r10,%[carry];" : [carry]"+r"(carry),[hi]"+r"(hi) : [i]"r"(i),[ql]"r"(ql),[qh]"r"(qh),[b]"r"(b.data),[sb]"r"(sb.data) : "%rax","%rdx","%r10","memory"); } asm("movq -8(%[b],%[i],8),%%rax;" "mulq %[qh];" "addq %%rax,%[hi];" "adcq %%rdx,%[carry];" "movq %[hi],0(%[sb],%[i],8);" "movq %[carry],8(%[sb],%[i],8);" : [hi]"+r"(hi),[carry]"+r"(carry) : [i]"r"(long(b.size)),[qh]"r"(qh),[b]"r"(b.data),[sb]"r"(sb.data) : "%rax","%rdx","memory"); I think it has to do with the fact that it's using so many registers. Is there something I'm missing here or is the register allocation just really buggy with gcc inline assembly?

    Read the article

  • Xcode/GCC predefined macro for target name?

    - by Justicle
    I was wondering if there is an Xcode or GCC preprocessor symbol for the target name of the application. For example if I'm building an application called "MonkeyChicken", is there a preprocessor symbol such that printf( __TARGET_NAME__ ) outputs: MonkeyChicken

    Read the article

  • GCC problem with raw double type comparisons

    - by Monomer
    I have the following bit of code, however when compiling it with GCC 4.4 with various optimization flags I get some unexpected results when its run. #include <iostream> int main() { const unsigned int cnt = 10; double lst[cnt] = { 0.0 }; const double v[4] = { 131.313, 737.373, 979.797, 731.137 }; for(unsigned int i = 0; i < cnt; ++i) { lst[i] = v[i % 4] * i; } for(unsigned int i = 0; i < cnt; ++i) { double d = v[i % 4] * i; if(lst[i] != d) { std::cout << "error @ : " << i << std::endl; return 1; } } return 0; } when compiled with: "g++ -pedantic -Wall -Werror -O1 -o test test.cpp" I get the following output: "error @ : 3" when compiled with: "g++ -pedantic -Wall -Werror -O2 -o test test.cpp" I get the following output: "error @ : 3" when compiled with: "g++ -pedantic -Wall -Werror -O3 -o test test.cpp" I get no errors when compiled with: "g++ -pedantic -Wall -Werror -o test test.cpp" I get no errors I do not believe this to be an issue related to rounding, or epsilon difference in the comparison. I've tried this with Intel v10 and MSVC 9.0 and they all seem to work as expected. I believe this should be nothing more than a bitwise compare. If I replace the if-statement with the following: if (static_cast<long long int>(lst[i]) != static_cast<long long int>(d)), and add "-Wno-long-long" I get no errors in any of the optimization modes when run. If I add std::cout << d << std::endl; before the "return 1", I get no errors in any of the optimization modes when run. Is this a bug in my code, or is there something wrong with GCC and the way it handles the double type?

    Read the article

  • gcc c++ command line error-message parser

    - by Autopulated
    Are there any programs for parsing and displaying in a nice format the c++ error messages generated by gcc. I'm really looking for something like less that I can pipe my errors into that will collapse the template parameter lists by default, maybe with some nice highlighting so that my errors are actually readable. (Yes, it's boost's fault I have such incomprehensible errors, in case you were wondering)

    Read the article

  • gcc -Wshadow is too strict?

    - by idimba
    In the following example: class A { int len(); void setLen(int len) { len_ = len; } // warning at this line int len_; }; gcc with -Wshadow issue a warning: main.cpp:4: warning: declaration of `len' shadows a member of `this' function len and integer len are of different type. Why the warning?

    Read the article

  • How to best use GCC with Visual Studio

    - by Oops
    I know this thread http://stackoverflow.com/questions/216025/gcc-with-visual-studio but to me it seems that everything mentioned there is rather outdated and it seems to be the tenor is: don't do it Who knows a better step by step explanation thank you in advance Oops

    Read the article

  • Trying to set up iPhone-gcc compiler

    - by Am4d
    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 to get this to work for a while, Any help would be great. Thanks Adam M

    Read the article

  • GCC compile time division error

    - by kartikmohta
    Can someone explain this behaviour? test.c: #include <stdio.h> int main(void) { printf("%d, %d\n", (int) (300.6000/0.05000), (int) (300.65000/0.05000)); printf("%f, %f\n", (300.6000/0.05000), (300.65000/0.05000)); return 0; } $ gcc test.c $ ./a.out 6012, 6012 6012.000000, 6013.000000 I checked the assembly code and it puts both the arguments of the first printf as 6012, so it seems to be a compile time bug.

    Read the article

  • recommending gcc to inline the function

    - by thetna
    I don't know how feasible it is and how sensible is this question here. Is there any changes that we can make in makefile to recommend GCC inline all the function although the functions are not inlined during the declaration or nowhere in the source file.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >