gcc c99 MS2005/2008  I have started program that will be compiled on linux/windows.   The program will be compiled on linux using gcc 4.4.1 c99. And on windows the compiler will be either MS 2005/2008. And this I cannot change.  I am using SCons to create the build files. However, the reason I choose c99 as I can use the stdint.h so my integers would be compatible between different architectures i.e. x86_32 and 64 bit. using int32_t so it will compile without any problem on both 32 and 64 bit machines.  However, I have just discovered that c99 isn't used for ms compilers. Only c89. However, c89 doesn't have the stdint.t.  I am wondering what is the best way to make the integer portable among different compilers running on either 32 or 64.  Many thanks for any advice,
83358
To my amazement I just discovered that the C99 stdint.h is missing from MS Visual Studio 2003 upwards.  I'm sure they have their reasons, but does anyone know where I can download a copy?  Without this header I have no definitions for useful types such as uint32_t, etc.
63666
We are getting very slow compile times, which can take upwards of 20+ minutes on dual core   2GHz, 2G Ram machines.  A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. (swapping out VSS is not an option unfortunately, so I don't want this to descend into a VSS bash)  We are looking at merging projects.  We are also looking at having multiple solutions to achieve greater separation of concerns and quicker compile times for each element of the application. This I can see will become a DLL hell as we try to keep things in synch.  I am interested to know how other teams have dealt with this scaling issue, what do you do when your code base reaches a critical mass that you are wasting half the day watching the status bar deliver compile messages.  UPDATE I neglected to mention this is a C# solution. Thanks for all the C++ suggestions, but it's been a few years since I've had to worry about headers.  EDIT:  Nice suggestions that have helped so far (not saying there aren't other nice suggestions below, just what has helped)   New 3GHz laptop - the power of lost utilization works wonders when whinging to management Disable Anti Virus during compile 'Disconnecting' from VSS (actually the network) during compile - I may get us to remove VS-VSS integration altogether and stick to using the VSS UI   Still not rip-snorting through a compile, but every bit helps.  Orion did mention in a comment that generics may have a play also. From my tests there does appear to be a minimal performance hit, but not high enough to sure - compile times can be inconsistent due to disc activity. Due to time limitations, my tests didn't include as many Generics, or as much code, as would appear in live system, so that may accumulate. I wouldn't avoid using generics where they are supposed to be used, just for compile time performance  WORKAROUND  We are testing the practice of building new areas of the application in new solutions, importing in the latest dlls as required, them integrating them into the larger solution when we are happy with them.  We may also do them same to existing code by creating temporary solutions that just encapsulate the areas we need to work on, and throwing them away after reintegrating the code. We need to weigh up the time it will take to reintegrate this code against the time we gain by not having Rip Van Winkle like experiences with rapid recompiling during development.
8143
I tried to compile some C code to get object file from a shell prompt:  $cc a.c     But this gives me the following error:  /usr/ucb/cc:  language optional software package not installed   How can I compile C code?
32481
We have a new application that requires glibc 2.4 (from gcc 4.1). The machine we have runs on has gcc 3.4.6.   We can not upgrade, and the application must be run on this machine.    We installed gcc 4.1, however, when it comes to compile time it is using all the includes, etc, from 3.4.6.    How do we get around this?  Any suggestions on using 4.1 for just this application?
123209
I'm trying to write a basic program in C using gedit or sublime text (which I prefer), but no matter what I do when I try to compile or run, or even while writing, I have no option to use 'stdio.h' or any similar package. Even when I start typing #include &lt;st the only word completion sublime suggests is 'struct'.  I've read dozens of threads, but all managed to fix this by installing gcc, which I've tried to reinstall multiple times, with no luck.  This is the output from gcc -v:  Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3) `   This is the code:   #include &lt;stdio.h&gt;  int main(void) { printf("hello, world\n"); }   When I compile using gcc, I get nothing, no error at least. but when I try to run using just ./hello.c this is what I get.
76951
I finished building the GCC 4.7.2 with C, C++ and Go compilers on my Ubuntu 12.04. I now want to add the Objective C compiler, is it possible to add it to the previous build? If so, how should i proceed?   Thanks.
51114
I need my code to do different things based on the operating system on which it gets compiled. I'm looking for something like this:  #ifdef OSisWindows // do Windows-specific stuff #else // do Unix-specific stuff #endif   Is there a way to do this? Is there a better way to do the same thing?
7842
I notice that modern C and C++ code seems to use size_t instead of int/unsigned int pretty much everywhere - from parameters for C string functions to the STL.  I am curious as to the reason for this and the benefits it brings.
44627
Is there some chance to know how a binary was built, under Linux? (and or other Unix)  Compiler, version, time, flags etc...  I looked at readelf and couldn't find much, but there might be other ways at analyzing the binary code/section etc...  Anything you know how to extract?
38606
The man command brings up a nice manual for many programs, but how can I use it more effectively? For example man gcc brings:  NAME        gcc - GNU project C and C++ compiler  SYNOPSIS        gcc [-c|-S|-E] [-std=standard]            [-g] [-pg] [-Olevel]            [-Wwarn...] [-Wpedantic]            [-Idir...] [-Ldir...]            [-Dmacro[=defn]...] [-Umacro]            [-foption...] [-mmachine-option...]            [-o outfile] [@file] infile...         Only the most useful options are listed here; see below for the        remainder.  g++ accepts mostly the same options as gcc. .... many text   But what if I need only some part of it? What is the best way to jump to the section where -Idir is described, for example?
16043
I've been having a problem with compiling.   I used the following test C code below and saved it as test.c in Home folder.  #include &lt;stdio.h&gt; int main() {   printf("Bruh!");   return 0; }   When I run in terminal the code   gcc test.c -o test   I get  nothing.  Thank you
64991
Suppose I want to compare gcc version to see whether the system has the minimum version installed or not.  To check the gcc version, I executed the following  gcc --version | head -n1 | cut -d" " -f4   The output was  4.8.5   So, I wrote a simple if statement to check this version against some other value  if [ "$(gcc --version | head -n1 | cut -d" " -f4)" -lt 5.0.0 ]; then     echo "Less than 5.0.0" else     echo "Greater than 5.0.0" fi   But it throws an error:  [: integer expression expected: 4.8.5   I understood my mistake that I was using strings to compare and the -lt requires integer. So, is there any other way to compare the versions?
63290
How can I compile/run C or C++ in Unix console or a Mac terminal?  (I know it, forget it, and relearn it again. Time to write it down.)
93631
Is it possible to write some C or C++ code and compile to binaries, then use those binaries with php? Is it also possible to write a php library using C and C++ ?  If so, please tell how can I do so?
9812
How should I run another program from within my C program? I need to be able to write data into STDIN of the launched program (and maybe read from it's STDOUT)  I am not sure if this is a standard C function. I need the solution that should work under Linux.
94357
Preferred languages: C/C++, Java, and Ruby.  I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby, so I prefer resources that involve one of those three, but any good resource is acceptable.
10581
I have the following code:  typedef void VOID; int f(void); int g(VOID);   which compiles just fine in C (using gcc 4.3.2 on Fedora 10). The same code compiled as C++ gives me the following error:  void.c:3: error: ‘&lt;anonymous&gt;’ has incomplete type void.c:3: error: invalid use of ‘VOID’   Now, this is something in external library and I would like the owner to fix that problem. So I have a question - does C++ standard forbids this construct? Could you give me a pointer/citation? The only thing I can recall is that function declaration with (void) to signal empty parameter list is deprecated in C++, but I don't understand why typedefed VOID does not work.