I'm trying to cross-compile on Linux (i686-w64-mingw32-gcc) a small 32-bit Windows program that requires (libz, libpng and) libgd. I have them all installed correctly, as far as I can tell, though the linker keeps on complaining it can't locate the libgd functions I'm using.  $ i686-w64-mingw32-gcc -lgd -lpng -lz -lm -o demo demo.o smssc.o demo.o:demo.c:(.text+0x2d): undefined reference to `_imp__gdImageCreateFromPng@4' demo.o:demo.c:(.text+0x1f7): undefined reference to `_imp__gdImageGetPixel@12' demo.o:demo.c:(.text+0x316): undefined reference to `_imp__gdImageCreate@8' demo.o:demo.c:(.text+0x368): undefined reference to `_imp__gdImagePaletteCopy@8' demo.o:demo.c:(.text+0x3b0): undefined reference to `_imp__gdImageGetPixel@12' demo.o:demo.c:(.text+0x3ec): undefined reference to `_imp__gdImageSetPixel@16' demo.o:demo.c:(.text+0x430): undefined reference to `_imp__gdImageDestroy@4' demo.o:demo.c:(.text+0x465): undefined reference to `_imp__gdImageSetPixel@16' demo.o:demo.c:(.text+0x4a9): undefined reference to `_imp__gdImageSetPixel@16' demo.o:demo.c:(.text+0x4e0): undefined reference to `_imp__gdImageColorAllocate@16' demo.o:demo.c:(.text+0x569): undefined reference to `_imp__gdImageLine@24' demo.o:demo.c:(.text+0x5e9): undefined reference to `_imp__gdImageLine@24' demo.o:demo.c:(.text+0x669): undefined reference to `_imp__gdImageLine@24' demo.o:demo.c:(.text+0x6e3): undefined reference to `_imp__gdImageLine@24' demo.o:demo.c:(.text+0x70f): undefined reference to `_imp__gdImagePng@8' demo.o:demo.c:(.text+0x71f): undefined reference to `_imp__gdImageDestroy@4'   this is how I had configured libgd  ./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32 CPPFLAGS="-I/usr/i686-w64-mingw32/include" LDFLAGS="-L/usr/i686-w64-mingw32/lib"   of course libgd.a, libpng.a and libz.a are found into my /usr/i686-w64-mingw32/lib  also, objdump output seems correct:  $ objdump -tT /usr/i686-w64-mingw32/lib/libgd.a In archive /usr/i686-w64-mingw32/lib/libgd.a: gd.o:     file format pe-i386 [snip]
22
Why does the order in which libraries are linked sometimes cause errors in GCC?
89085
I learned today that there are digraphs in C99 and C++.  The following is a valid program:  %:include &lt;stdio.h&gt;  %:ifndef BUFSIZE  %:define BUFSIZE  512 %:endif  void copy(char d&lt;::&gt;, const char s&lt;::&gt;, int len) &lt;%     while (len-- &gt;= 0)     &lt;%         d&lt;:len:&gt; = s&lt;:len:&gt;;     %&gt; %&gt;   My question is: why do they exist?
3570
So I have installed gcc-4.4 and gcc-4.3 (same for g++). Now as far as I remember there is a tool in Ubuntu which sets the symlinks for you if you just tell it which version you want. However it does not seem to work in the newest version, which I find disappointing.  root@nexus:~# update-alternatives --config gcc update-alternatives: error: no alternatives for gcc. root@nexus:~# update-alternatives --config cc There is only one alternative in link group cc: /usr/bin/gcc Nothing to configure.   root@nexus:~# dpkg -l | grep gcc | awk '{print $2}' gcc gcc-4.3 gcc-4.3-base gcc-4.3-multilib gcc-4.4 gcc-4.4-base gcc-4.4-multilib gcc-4.5-base gcc-multilib lib32gcc1 libgcc1   Any ideas?
89683
I wrote this program:  #include&lt;stdio.h&gt; int main() { printf(“Hello World\n”); return 0; }   I saved it as first.c and tried to compile but receiving this problem I have installed even gcc compiler too.  $ gcc first.c -o first1 first.c: In function ‘main’: first.c:4:1: error: stray ‘\342’ in program first.c:4:1: error: stray ‘\200’ in program first.c:4:1: error: stray ‘\234’ in program first.c:4:11: error: ‘Hello’ undeclared (first use in this function) first.c:4:11: note: each undeclared identifier is reported only once for each function  it appears in first.c:4:17: error: expected ‘)’ before ‘World’ first.c:4:17: error: stray ‘\’ in program first.c:4:17: error: stray ‘\342’ in program first.c:4:17: error: stray ‘\200’ in program first.c:4:17: error: stray ‘\235’ in program   How can I fix this problem?
42860
I need to compile all of the C files in a directory into seperate outputs... see example gcc -Wall program1.c -o program1.out  How do I do this?
100590
When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker.  In the case of GCC, the option is -g.  When the debug option is enabled, how does the affect the binary executable?  What additional data is stored in the file that allows the debugger function as it does?
85444
I'm not really sure if this belongs on SuperUser or StackOverflow, but it doesn't seem to be a coding problem so I'm gonna run with this.  I've started working on a C++ game using Visual Studio 2013 utilizing FreeGLUT and FreeImage. I can compile and run it on my desktop without issue, but when I try compiling the same code on my laptop I get the error "msvcr110d.dll is missing from your computer." After which there is about a 50% chance that Visual Studio freezes, and I'm forced to restart the computer as Task Manager cannot stop the process (another problem I'm still working on).  Google searches have told me to install Visual C++ Redistributable 2012, however this was already installed on this laptop (both x86 and x64), and reinstalling (from ) has not helped at all. I also tried installing Visual C++ Redistributable 2013 (x86 &amp; x64, from ), but to no avail. Both of those links do feature an ARM download. I'm not sure what that is, and attempting to install it results in a pop-up saying I can't install it on this version of Windows (Windows 8 that is), so I'm assuming I don't need that.  Looking in the C:\Windows\SysWow64 folder, I can see msvcr110.dll but not msvcr110d.dll. It looks like the release version was installed, but not the debug. I do see msvcr120d.dll, which should be the 2013 version right? So shouldn't Visual Studio 2013 be using that, instead of msvcr110d.dll?  Running a standard C++ HelloWorld project doesn't have this issue, so I imagine it must have something to do with FreeGLUT or FreeImage. However it compiles and runs on my desktop without issue, so I believe everything is coded &amp; linked correctly. I've added the include directories, library directories (both of which were debug), and added opengl32.lib &amp; FreeImaged.lib as additional dependencies.  Installing Visual C++ Redistributable hasn't helped, so is there another way of solving this issue? Should Visual Studio 2013 be using msvcr110d.dll at all, or it should be using msvcr120d.dll? Do I need that ARM install from the MSVCR download page? I'm using Windows 8 64 bit (brand new laptop as well so I don't think there's any corruption issues). Thanks in advance for your help.  Doug
68142
Background: I'm trying to build my program but first I need to set up libraries in netbeans. My project is using GLU and therefore I installed libglu-dev. I didn't note location where the libraries were located and now I can't find them..  I've switched to Linux just a few days ago and so far I'm very content with it, however I couldn't google this one out and becoming frustrated.. Is there way to find out where files of package were installed without running installation again? I mean if I got library xxx and installed it some time ago, is there somecommand xxx that will print this info?  I've already tried locate, find and whereis commands but either I'm missing something or I just can't do it correctly.. for libglu, locate returns:  /usr/share/bug/libglu1-mesa /usr/share/bug/libglu1-mesa/control /usr/share/bug/libglu1-mesa/script /usr/share/doc/libglu1-mesa /usr/share/doc/libglu1-mesa/changelog.Debian.gz /usr/share/doc/libglu1-mesa/copyright /usr/share/lintian/overrides/libglu1-mesa /var/lib/dpkg/info/libglu1-mesa:i386.list /var/lib/dpkg/info/libglu1-mesa:i386.md5sums /var/lib/dpkg/info/libglu1-mesa:i386.postinst /var/lib/dpkg/info/libglu1-mesa:i386.postrm /var/lib/dpkg/info/libglu1-mesa:i386.shlibs   Other two commands fail to find anything. Now locate did it's job but I'm sure none of those paths is where the library actually resides (at least everything I was linking so far was in /usr/lib or usr/local/lib).   The libglu was introduced just as example, I'm looking for general solution for this problem.
80212
For many questions the answer seems to be found in "the standard". However, where do we find that? Preferably online.  Googling can sometimes feel futile, again especially for the C standards, since they are drowned in the flood of discussions on programming forums.  To get this started, since these are the ones I am searching for right now, where are there good online resources for:   C89 C99 C11 C++98 C++03 C++11 C++14 C++17
15417
Is there a need to install a C/C++ compiler in Ubuntu 14.04 LTS? Where to write the program? How to compile the same?
12096
I have gcc 7.3.0 on Ubuntu 18.04. But I am working on a project where I need gcc less than version 6. When I tried to install gcc 5.4 using sudo apt install gcc-5.4, I got this error:  Reading package lists... Done Building dependency tree        Reading state information... Done E: Unable to locate package gcc-5.4 E: Couldn't find any package by glob 'gcc-5.4' E: Couldn't find any package by regex 'gcc-5.4'     What is the appropriate way to install gcc 5.4?
12589
I shifted to Ubuntu 10.10 now I am facing problem to have C/C++ compiler. What are the possible ways so that I can use C/C++ compiler using all the libraries (like graphic, math, conio, stdlib, etc) as in Microsoft Windows creating executable file?
117410
In Linux environment, when getting "glibc detected *** free(): invalid pointer" errors, how do I identify which line of code is causing it?  Is there a way to force an abort? I recall there being an ENV var to control this?  How to set a breakpoint in gdb for the glibc error?
80442
What is a simple way to have \ll on top of \gg with equal size and vertically center aligned and have them work as a binary relation symbol like \lessgtr? The commands \underset and \overset cannot be used because they do not treat the two symbols equally, and they do not vertically center.
36363
Session transcript: &gt; type lookma.c int main() {   printf(&quot;%s&quot;, &quot;no stdio.h&quot;); }  &gt; cl lookma.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation.  All rights reserved.  lookma.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation.  All rights reserved.  /out:lookma.exe lookma.obj  &gt; lookma no stdio.h
105487
I'm trying to  working on Linux. I have PAINSTAKINGLY installed NVidia drivers, Cuda 5.0 and incidentally I'm failing on the last step when I run make:  make  all-recursive make[1]: Entering directory `/var/progs/CudaMiner' Making all in compat make[2]: Entering directory `/var/progs/CudaMiner/compat' Making all in jansson make[3]: Entering directory `/var/progs/CudaMiner/compat/jansson' gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT dump.o -MD -MP -MF .deps/dump.Tpo -c -o dump.o dump.c /bin/bash: gcc: command not found make[3]: *** [dump.o] Error 127 make[3]: Leaving directory `/var/progs/CudaMiner/compat/jansson' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/var/progs/CudaMiner/compat' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/progs/CudaMiner' make: *** [all] Error 2   I'm pretty sure I have gcc, in fact I have multiple versions of it. I installed version 4.6 (which is what cuda requires) but it doesn't seem to find it. I'm so close!  Thanks in advance.
79648
I have installed GCC compiler by installing the build-essential package.  After the installation I wrote a simple C program. I tried to run it with the following command:  gcc First.c ./a.out   but I'm getting a bash: ./a.out: Permission denied message. I don't know what to do now.