gcc compiler giving error because missing files for flags - gcc

I am trying to compile code for a course. I want to use the -Wall -pedantic and -std=c99 tag since those are used to check the code by the teachers. In a previous course where I had to do this I ran the code on a linux virtual boot provided by the teachers where everything was preinstalled to run the code. But since then I switched over my PC to linux from windows so I do not have those things installed. when running the following command in my terminal
gcc −std=c99 −Wall −pedantic myprogram.c
I get the following errors roughly translated to english.
gcc: error: -std=cgg: File or directory does not exist
gcc: error: -Wall: File or directory does not exist
gcc: error: -pedantic: File or directory does not exist
what do I have to install and how to make this working?

Related

Modelsim, Fatal: (vsim-3828) Could not link 'vsim_auto_compile.so on Manjaro Linux

I'm trying to compile a uvm project on my machine and I keep getting the following error message. I'm on Manajaro, I have multilib enabled on my system and I have followed the instructions on this page All the required dependencies are Installed.
I can start modelsim from commandline without any issues, but when I call this makefile, it always fails at the below line. Which makes me believe I might be missing something related to gcc, but I'm not sure what that is and googling this particular issue has yielded no results.
Compiling /tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/exportwrapper.c
# ** Fatal: ** Fatal: (vsim-3828) Could not link 'vsim_auto_compile.so': cmd = '/opt/modeltech/gcc-5.3.0-linux/bin/g++ -shared -fPIC -m32 -o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/vsim_auto_compile.so" /home/cyberbemon/Development/uvm/final/tb_build/sub_system_tbs/pss_tb/sim/work/_dpi/auto_compile#/linux_gcc-5.3.0/*.o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/exportwrapper.o" -Wl,-Bsymbolic '
# (vsim-50) A call to system(/opt/modeltech/gcc-5.3.0-linux/bin/g++ -shared -fPIC -m32 -o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/vsim_auto_compile.so" /home/cyberbemon/Development/uvm/final/tb_build/sub_system_tbs/pss_tb/sim/work/_dpi/auto_compile#/linux_gcc-5.3.0/*.o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/exportwrapper.o" -Wl,-Bsymbolic >'/tmp/questatmp.AFzKOV' 2>&1) returned error code '1'.
# The logfile contains the following messages:
# /lib/crti.o: file not recognized: File format not recognized
# collect2: error: ld returned 1 exit status
This issues was caused by Modelsim using a different gcc version, manually deleting all the gcc-..*-linux folders from modelsim directory forced it to use my system GCC and that has solved the issue.
This solution was suggested here
Instead of manually deleting it, you can re-run the installer and choose to remove the GCC components. You will get the same result.

Missing file when cross-compiling for Amiga on Ubuntu 16.04

I am trying to build some software for AmigaDOS 3.x on a ubuntu 16.04 host system, but at link time I get this error:
/opt/m68k-amigaos/m68k-amigaos/bin/ld: cannot open crt0.o: No such file or directory
The process of building from .c to .o works fine and with no errors. Its only the link stage that displays any error. The link command I am using is:
sst: $(OFILES)
m68k-amigaos-gcc -o sst $(OFILES) -lm
Any ideas?
The question was answered here:
https://github.com/adtools/amigaos-cross-toolchain/issues/12
I will copy/paste it here, in case the original post on Github became unavailable:
You need to use -noixemul switch during linking stage, otherwise the toolchain will try to use ixemul startup routine which is not available.
$ m68k-amigaos-gcc -noixemul hello.c -o hello

c++: error: unrecognized command line option ‘-std=c++14’

I just moved my PC from Ubuntu 15.10 to Linux Mint 17.3.
Before this shift, this project compiled just fine in CLion. Now, it gives the following error:
c++: error: unrecognized command line option ‘-std=c++14’
This is probably due to this line in my CMake file:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -W -Wall -Wextra -pedantic")
I suspect this error is due to some outdated library/compiler. I don't know exactly what I need to do.
P.S.: I know that C++14 is not completely supported in CLion, and the editor will complain about syntax errors, but it will compile fine nonetheless.
-std=c++14 is called -std=c++1y in old gcc versions (at least 4.9 and older).
I am working on a high-performance cluster and the "default" version of gcc is 4.8.5, which is why I also ran into the error c++: error: unrecognized command line option ‘-std=c++14’.
Not having sudo rights, I could solve the issue by loading a module (https://modules.readthedocs.io/en/latest/) containing a more recent gcc version (module load compiler/gnu/9.1). So if you are working on a cluster check out module avail (or in general the documentation of the cluster).

libpcap compiling as external library

I'm making a project that requires libpcap library, I downloaded the library from official website (libpcap-1.7.2.tar.gz) and I want to compile and the project on Unix server, but I am not allowed to install the library there (school server) and I cannot run the gcc as root.
What command shall I use? Or is it even possible? I can't find any info. (.. my aim is to run the binary on another linux OS (with root permissions) without the need of installing the lib.)
I already tried:
gcc -Wall test.c -lpcap -Ilib/libpcap-1.7.2
but getting an error:
lib/libpcap-1.7.2/pcap.h:43:23: fatal error: pcap/pcap.h: No such file or directory
#include <pcap/pcap.h>
^

Can't make FestVox compile due to missing -leststring and missing libeststring.a

So I have installed / compiled speech_tools, and Festival (2.3) using Cygwin on my Win8.1 machine to the point that I can successfully produce speech using this command:
echo "hello world" | \src\main\festival --tts
The next step is for me to get FestVox running. I have downloaded FestVox 2.6 and I have run ./configure; however, the 'make' step is giving me trouble, producing this error:
gcc -O3 -Wall -o phonealign phonealign_main.o -LC:/cygwin64/Festival/build
/speech_tools/lib -lestools -lestbase -leststring -lncurses -lstdc++ -lm -lwinmm -luser32
/usr/bin/ld: cannot find -leststring
collect2: error: ld returned 1 exit status
Makefile:80: recipe for target 'phonealign' failed
So, I looked at my Makefile at where it might be trying to look for this file, and it looks like in that directory (build\speech_tools\lib) I am missing a libeststring.a partner for my libeststring.lib. Both libestbase and libestools have .lib and .a files in that directory.
At what step did I go wrong?? Should a libeststring.a have been created at some point??? When? How can I fix this?
I think the problem is that you should use compiler in Windows instead of gcc within Cygwin. The role in Cygwin for building Festival is to run configure to generate a Makefile for VC. Then run nmake in Windows command line not make within Cygwin.
Cygwin cannot build a native Windows application like what MINGW does. Application build in Cygwin can only run within Cygwin.
*.a is the static library for Linux, which is built by gcc. *.lib is the static library for Windows, which is built by VC.
So I suggest you taking a look at README, INSTALL files in FestVox. To find whether there is description for make a Makefile for Windows like process "3. Make makefile for VC in Cygwin" in my document (http://www.eguidedog.net/doc_build_win_festival.php)
Cameron

Resources