Click here to Skip to main content
15,889,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am a new to Unix.
I want to call my C program from shell script.
For that i created one simple application in C, which accepts 2 files as argument and print it.
I created one shell script having following contents,
cc -o Test Test.cpp
Test ABC.txt XYZ.txt

It works fine for me. Is it the correct way? If any other way is also available please let me know.

Now i want to create one shell script with one file as parameter and i need to pass it to my .cpp file with one more file as parameter.
But my .cpp file had some user defined header files, and that header files also has other header files.
While compiling my .cpp file i am receiving error for that sub header files. To remove that i used cc -I option, but for all header files i need to mention the path in my shell script which is not a good program.
Some files had "Permission Denied", how can I include it for compilation.
Is there any way to do the compilation?
Can anybody tell me about how can I do this?

Thanks in advance.
Posted
Updated 6-Apr-10 3:07am
v3

Usually it will be "scripted" separately :) :
- Build stage (development)
(scripts to compile and link, to use make-files...)
- Call stage (users)
(scripts to start the built (by first stage) executables with their parameters...)

For example :) :
Script 1, used at develpment:
cc -o Test Test.cpp

Script 2, used by users
Test ABC.txt XYZ.txt



Poonamol wrote:
If I create a make file to create .lib and .obj files, then is it possible to gice the reference of make file into the shell script with parameters?


Yes[^] , it would be something like this :) :
make -f test.mak -I /usr/poony/my_includes
 
Share this answer
 
v3
Can you please elaborate on this with example.

If I create a make file to create .lib and .obj files, then is it possible to gice the reference of make file into the shell script with parameters?


:-O
 
Share this answer
 
v2
Hi,

I had created makefile to compile and create .exe file.
but while executing makefile i am receiving following error

0711-317 Error: undefined symbol: .fn_error(......)
0711-345 use the -bloadmap or -bnoquiet option to obtain more information.
make :...... Error 8

Could you please help me to get out of it and create proper executable of my code.

Thanks in advance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900