sorry for my question, I get homework in my university, I need make a programm in C programming language, but when I start with on Mac OS (in school we use OpenSolaris I think) I got this problem, can I fix it without Unix installation?
Console output: (screenshot)
MBP-Maxim:cv01 maxim$ g++ main.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You have two problems:
g++ is a C++ compiler. Your source file is C, not C++. Use gcc to compile C source code.
The file you are trying to compile doesn't have a main function, which is required to generate an executable. Write one.
Just to elaborate more on @duskwuff-inactive- reply
For warning like this clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
Your file name is main.c instead of main.cpp or main.cc when compiling with g++ compiler or use gcc compiler for main.c.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With