Unable to run executable generated after compilation


I am new to C++. There is an application developed by my peers using Microsoft Visual Studio which compiles and runs as expected on Windows platform. I need to move this application to Unix server and run.

I was able to compile the programs and generate exe using the command below.

gcc-2.95 -MM -g Main_Prg.cpp Config.cpp Data.cpp -o hello

but when I try to run exe
./hello /home/imran/rnd /home/imran/rnd/Output/cart.dd

getting an error like
./hello: line 1: Data.o:: command not found

Also tried to run gdb
gdb -tui hello

but it says
This GDB was configured as "i486-linux-gnu"..."/home/imran/rnd/src/hello": not in executable format: File format not recognized

below is the output of file hello command
hello: ASCII text

Any help would be highly appreciated.
If the programs runs as expected my next task to build a make file for the application.

You didn't read the manual. You can read the manual by typing
% man gcc
At the command line.

The flag -MM implies -E, which directs the compiler to stop after the preprocessing stage. The output hello contains an auto-dependency rule for use with make.

Also, the current version of GCC is 7.2.0. You should consider updating.

If your application was written in C++, you should use the C++ compiler. It is named g++; gcc is merely the C compiler.
Last edited on
Topic archived. No new replies allowed.