gcc

What exactly does -march=native do?

Gentoo Wiki told me the following: Warning: GCC 4.2 and above support -march=native. -march=native applies additional settings beyond -march, specific to your CPU. Unless you have a specific reason not to (e.g. distcc cross-compiling), you should probably be using -march=native, rather than anything listed below. What a...

How to best use GCC with Visual Studio

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 ...

11415 compile errors FTW?!

Hello. This is something I've really never seen but, I downloaded the source code of the sine wave example at http://www.audiosynth.com/sinewavedemo.html . It is in an old Project Builder Project format, and I want to compile it with Xcode (GCC). However, Xcode gives me 11415 compile errors. The first few are (all in the precompilation ...

How to calculate gcc compilation time ?

Hi Guys I what know gcc compile time. gcc have any command or option for calculate compile time? [example] I have file hello.c and then compile.I what know spent time to compile ...

Can I make a pointer to the code, and pass to the next instruction?

Like this link http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Labels-as-Values.html I can get the memory address of an label, so if I declare a label, get your address, and add your address, i will pass to next instruction? some ilustration > int main () { void *ptr; label: instruction 1; instruction 2; ptr = // ...

Why doesn't a 32bit .deb package install on 64bit Ubuntu?

My .deb package, built on 32-bit Ubuntu and containing executables compiled with gcc, won't install on the 64-bit version of the OS (the error message says 'Wrong architecture i386'). This is confusing to me because I thought that in general 32-bit software worked on 64-bit hardware, but not vice-versa. Will it be possible for me to pr...

dll runtime error(C/C++/GCC/MSVC)

After two days fighting, I make the dll(compiled in GCC/G++) link correctly in MSVC, but while debuging, I got the runtime error, is say that: Runtime Error! Program: my_exe.exe This application has required the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. I ha...

Compilation error while compiling an existing code base

Hi, While building an existing code base on Mac OS using its native build setup I am getting some basic strange error while compilation phase. Does any of you have any idea, as I have seen it's been discussed earlier as well in this forum without any good reason. I can not see any conflicting files being included. But still I am unable...

GCC Preprocessor for inline method name

Hi I'm working on a project where I have code like the following: #define NAME() Array inline NAME()* NAME()_init (void* arg0){return (NAME()*)Object_init(arg0);} But I get the following result: inline Array* Array _init (void* arg0){return (Array*)Object_init(arg0);} With a space between the "Array" and the "_init" Because this ...

Illegal Instruction When Programming C++ on Linux

Heyo, My program, which does exactly the same thing every time it runs (moves a point sprite into the distance) will randomly fail with the text on the terminal 'Illegal Instruction'. My googling has found people encountering this when writing assembly which makes sense because assembly throws those kinds of errors. But why would g...

gcc and reentrant code

Does GCC generate reentrant code for all scenarios ? ...

error: typedef name may not be a nested-name-specifier

I am trying to do something along the lines of this answer, and struggling: $ gcc --version gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4) file.cpp:7: error: template argument 1 is invalid file.cpp:7: error: typedef name may not be a nested-name-specifier And the offending part of the file: template <class R, class C, class T0=void, cl...

how to find which libraries to link to? or, how can I create *-config (such as sdl-config, llvm-config)?

Hey, I want to write a program that outputs a list of libraries that I should link to given source code (or object) files (for C or C++ programs). In *nix, there are useful tools such as sdl-config and llvm-config. But, I want my program to work on Windows, too. Usage: get-library-names -l /path/to/lib a.cpp b.cpp c.cpp d.obj Then...

Subsume external library into source tree with Autotools.

I am developing a new project, using Autotools for my build infrastructure. I would like to subsume external dependencies into my source tree. These dependencies are using Autotools, as well. How can I configure my project's build scripts to build and link against subsumed dependencies? Though Duret-Lutz's tutorial is excellent, this sit...

GCC: Compile to assembly with clarified correspondence to code?

When you break into the debugger in VS and open the disassembly window, each assembly fragment is displayed below it's corresponding code section (more or less). GCC with -S outputs only the stripped down assembly. Is there an option in GCC to show some correspondence to the original code? Source code is C++. ...

gcc c++ command line error-message parser

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 ...

How to run multiple arguments in Cygwin

I've been trying to run a program that will invert the order of a string and to run it, I have to type a second argument in prompt. int main(int argc, char* argv[]) { string text = argv[2]; for (int num=text.size(); num>0; num--) { cout << text.at(num); } return 0; } e.g. ./program lorem result: me...

error compiling gcc: undefined reference to libc_name_p

When compiling GCC it is possible to get very far in the build process only to hiccup on an error complaining about the lack of gperf installed. After installing gperf and running, I hit an "undefined reference to libc_name_p." I've looked at the solutions here and here but they weren't helpful. ...

C inline assembly of x86 fbstp instruction

Was wondering how to inline a usage of fbstp on a 32 bit I86 architecture. I tried something like int main( ) { double foo = 100.0; long bar = 0; asm( "pushl %1; fbstp %0" : "=m"(bar) : "r"(foo) ); ... But bar is unchanged. I have tried reading everything I can find on this but most example ...

GCC template issues

Possible Duplicate: problem with template inheritance This code doesn't compile in GCC: template <typename T> struct Base { public: int x; }; template <typename B> struct Middle : public B { }; template <typename T> struct Sub : public Middle<Base<T> > { public: void F() { x=1; // error: ‘x’ was not declared in this sc...