compile a c program with gcc in cmd ( .c, .cpp and .h) -
i have 3 files:
mainoperations.cpp operations.c operations.h (does functions, not importat in, looking)
i trying run cmd gcc this: "gcc -o c:...\ mainoperations.cpp operations.c operations.h" "no such file or directory" of them. so, question run gcc cmd? (windows 7)thx!
the command have written in worst case overwrite mainoperations.cpp.
there several things might have missed.
you have
cppfile, c++ , not c, not needgcc,g++(g++able handle c code! if have mixed code, useg++).the parameter
-ospecifies output file, have pointedcppfile, thus, if compiler gets work, overwrites file binary code , gives fuzzy errors.you dont need pass
.hor.hppfiles compiler, need tell compiler find them
the easiest way achieve want be:
g++ -o "c:\mybinary.exe" "c:\path\to\files\*.cpp" "c:\path\to\files\*.c" -i"c:\path\to\files\" what does: generetes file c:\mybinary.exe out of cpp , c files in c:\path\to\files whilst searching headerfiles (not only) in c:\path\to\files, .h files lie.
all of have been told manpage or documentation, next time, show research effort. there plenty of resources telling how use compiler!
Comments
Post a Comment