Installing GCC on macOS Catalina

Probably not the elegant answer, but it worked. I was able to find the header files needed using $(xcrun –show-sdk-path) I then copied them all to /usr/local where the gcc location was expecting them to be. Now all works.

error: use of deleted function

The error message clearly says that the default constructor has been deleted implicitly. It even says why: the class contains a non-static, const variable, which would not be initialized by the default ctor. Since X::x is const, it must be initialized — but a default ctor wouldn’t normally initialize it (because it’s a POD type). Therefore, to get a … Read more

gcc/g++: “No such file or directory”

Your compiler just tried to compile the file named foo.cc. Upon hitting line number line, the compiler finds: or The compiler then tries to find that file. For this, it uses a set of directories to look into, but within this set, there is no file bar. For an explanation of the difference between the versions of the … Read more

What is the “Illegal Instruction: 4” error and why does “-mmacosx-version-min=10.x” fix it?

From the Apple Developer Forum (account required): “The compiler and linker are capable of using features and performing optimizations that do not work on older OS versions. -mmacosx-version-min tells the tools what OS versions you need to work with, so the tools can disable optimizations that won’t run on those OS versions. If you need to run on older … Read more

What is a file with extension .a?

.a files are static libraries typically generated by the archive tool. You usually include the header files associated with that static library and then link to the library when you are compiling.

conflicting types error when compiling c program using gcc

If you don’t declare a function and it only appears after being called, it is automatically assumed to be int, so in your case, you didn’t declare before you call it in main, so the compiler assume there are functions which their prototypes are int my_print2 (char *); and int my_print2 (char *); and you can’t have two functions with … Read more

Categories C Tags ,

Compiling a C++ program with gcc

gcc can actually compile c++ code just fine. The errors you received are linker errors, not compiler errors. Odds are that if you change the compilation line to be this: which makes it link to the standard c++ library, then it will work just fine. However, you should just make your life easier and use g++. EDIT: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)