gcc

Do I need to #include <omp.h> in my C/C++ sources?

Is it necessary to include omp.h in my C/C++ sources? Why? Or why not? Does the gcc compiler include it by default when used with the -fopenmp flag? It doesn't seem te make a differance. ...

Working with GNU regex functions in C or C++

Can anyone give me complete example program how to work with GNU regex functions in gcc C or C++ (http://docs.freebsd.org/info/regex/regex.info.GNU_Regex_Functions.html), with re_pattern_buffer, re_compile_fastmap? For example, translate this small Python program: import re unlucky = re.compile('1\d*?3') nums = ("13", "31", "777", "1...

How to workaround gcc-3.4 bug (or maybe this is not a bug)?

Hello, Question Following code fails with a error message : t.cpp: In function `void test()': t.cpp:35: error: expected primary-expression before '>' token t.cpp:35: error: expected primary-expression before ')' token Now I don't see any issues with the code and it compiles with gcc-4.x and MSVC 2005 but not with gcc-3.4 (which is s...

Error in compiling C++ code?

This is my test.cpp: #include <iostream.h> class C { public: C(); ~C(); }; int main() { C obj; return 0; } When I compile it using the command g++ test.cpp, I get this error message: In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31, from test.cpp:1: /usr/lib/gcc...

Does anyone know what the "-FC" option does in gcc g++?

Does anyone know what the "-FC" option does in g++? I have it in my SConstruct script that builds the command line g++ command, I have searched google ...

va_list has not been declared

When compiling some working code on Fedora 11, I am getting this error: /usr/include/c++/4.4.1/cstdarg:56: error: ‘::va_list’ has not been declared I am using: [doriad@davedesktop VTK]$ g++ --version g++ (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) Does anyone know what the problem could be? Thanks, Dave ...

C code compilation failure

i have this makefile below and in it my includes are gtk/gtk.h and webkit/webkit.h but when i try to build the project using the make command i have the errors error: gtk/gtk.h: No such file or directory error: webkit/webkit.h: No such file or directory in case the gtk+-2.0.pc and webkit...pc are in the usr/lib/pkgconfig Make Fil...

Using gcc with MinGW

So, I installed the MinGW base tools according to the instructions given and everything went fine. Now, when I try to call gcc from the Command Prompt, still nothing happens. How do I use gcc? ...

How to set warning level in CMake?

How to set the warning level for a project (not the whole solution) using CMake? Should work on Visual Studio and GCC. I found various options but most seem either not to work or are not consistent with the documentation. ...

How does the gcc option -fstack-check exactly work?

My program crashed when I added the option -fstack-check and -fstack-protector. __stack_chk_fail is called in the back trace. So how could I know where the problem is ? What does -fstack-check really check ? The information about gcc seems too huge to find out the answer. ...

How to overcome vc++ warning C4003 while writing common code for both gcc and vc++

I have a code that is compiled in both gcc and vc++. The code has a common macro which is called in two scenarios. When we pass some parameters to it. When we don't want to pass any parameters to it. An example of such a code is: #define B(X) A1##X int main() { int B(123), B(); return 0; } The expect output from ...

How to write C .so library to subsitute existing C++ .so library?

Hi, all Let me explain the scenario. We have a legacy C++ compiled .so library. The functions in this library are declared with extern "c" {}, so the library can be used by both C and C++ program, plus, for some reason it was created with--static-libgcc option. This old library is very old and hard to maintain. Now we haved managed to...

Which format does static library (*.lib) files use? Where can I find "Official" specifications of *.LIB file structure/format?

Just now I found that static libraries in *nix systems, in other words *.a libraries are nothing but archives of relocatables(*.o files) in ar fromat. What about static libraries(*.lib files) in windows? Which format are they in? I found an article: http://www.microsoft.com/msj/0498/hood0498.aspx which explains *.lib file structure. ...

Weird problem porting application. Undefined reference errors in standard libraries

Hello, I've recently been trying to port a C++ application. I believe I have all of it's dependencies and such and it all compiles. But then, when it goes to link it I get a lot of weird undefined reference errors. /usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >::seekg(long...

Scrapy install: no acceptable C compiler found in $PATH

I am trying to install Scrapy on a a Mac OS X 10.6.2 machine... When i try to build one of the dependent modules ( libxml2 ) I am getting the following error: configure: error: no acceptable C compiler found in $PATH I assume I need the gcc...is that easy to install on 10.6? Is there some sort of package I should be installing, so ...

wxWidgets linking problem

I installed wxWidgets-2.8.10 following instructions from this page: http://wiki.wxwidgets.org/Compiling_and_getting_started Libraries directory: alex@alex-linux:/usr/local/lib$ ls | grep wx libwx_base-2.8.a libwx_base_net-2.8.a libwx_base_xml-2.8.a libwx_gtk2_adv-2.8.a libwx_gtk2_aui-2.8.a libwx_gtk2_core-2.8.a libwx_gtk2_html-2.8.a ...

Preprocessor variable when using Adobe Alchemy

I'm porting a cross-platform lib I use to Alchemy. One particular file has a block of code similar to this : #if defined(WIN32) // Do some Windows-specific stuff #elif defined(__linux__) // Do some linux-specific stuff #endif I now need to add Flash-specific code (NOP in some cases), but so far I've been unable to find what do...

Avoiding exporting symbols from executables on Linux

I'm finding that when I link an executable against a static library (.a), the symbols from the static library end up being exported by the executable file. I would like to avoid this and export nothing. I've tried providing a version script, but it seems to make no difference. The contents of my version script are as follows: { glo...

gcc generates 32bit code on sparc

I have a Solaris sparc machine and when i build my programs, it generates 32bit code which should be 64bit. How to check the cause? $uname -a SunOS sol 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire-V240 $/usr/sfw/bin/gcc --version gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) Copyright (C) 2004 Free Software Foundation, Inc. T...

Why gcc can compile C++ code but can not link?

I know that c++ code should be compiled and linked by g++, not gcc. But why gcc can still compile c++ source code in spite of lots of c++ keywords in the source. By the way, I found that I even can build a shared library by gcc with all c++ code. Why? ...