I can only compile my source code if the command prompt is pointed to the compiler directory or the source code directory. Basically, I can get the compiler to compile from either:

C:\Borland\BCC55\Bin>
C:\bcc32>

or

C:\01proj\hworld.cpp
(location of source code)

My source code is

// C++ code template
#include <iostream.h>
void main()
	{
		cout << "Hello, World!" << endl;

        }

I have created the bcc32.cfg and ilink32.cfg files and placed them in the \bin folder in the Borland directory. I have also appended the path in the system variable with C:\borland\bcc55\bin

I should be able to compile from my default command prompt (C:\Users\Allen>) and not have to do so with the command prompt only pointed at the compiler or the source code directory.

Any ideas anyone?
Thanks--

when compiling from a command prompt you need to set the PATH environment variable to include the compiler's bin directory or whereever the compiler's executable files are. you can do like this:
write a small batch file that contains this line SET PATH=%PATH%;C:\BORLAND\BCC55\BIN Then every time you create a command prompt you have to execute the above batch file. You can also just simply type it instead of writing a batch file, but a batch file saves time.

There is another way to make the change permanent, but how to do it depends on what version of Windows you are running.

>>void main
main ALWAYS returns int, so the only legal declaration of that function is int main() [edit]
>> I have also appended the path in the system variable with C:\borland\bcc55\bin
Oops. I didn't notice that statement when I wrote the above. Did you display the path to verify you did it correctly ? In older versions of Windows the path can become too long and attempts to add more stuff will fail.

[edit]

I have also appended the path in the system variable with C:\borland\bcc55\bin
Oops. I didn't notice that statement when I wrote the above. Did you display the path to verify you did it correctly ? In older versions of Windows the path can become too long and attempts to add more stuff will fail.

I did display the path from the command prompt and C:\BORLAND\BCC55\BIN shows up twice; at the end of the string and in the middle. I appended this value in the system variable. I also tried appending it to the user variable but when that did not work I removed it, leaving the value appended to the system variable only.

My OS is Vista

Problem: Can't compile code from cmd.exe even though logged on as administrator.

Solution: Set properties, 'Run as administrator'. In Vista, the requested operation requires elevation.

Hi,

I am currently doing an C++ application which need to run a build file using command prompt. I tried to use the command:

system("c:\desktop\helloworld");
system("bldmake bldfiles winscw");

However I can't run the two command in the same command prompt window. Anypro fren can give me suggestion or good solution? I need this urgently.

Thank you.

Regards,

Adrian

Which compiler are you using?
Which Operating System?

I am using Symbian OS, UIQ3.1SDK.

I just wan to know whether got any C++ code that are able to run more than 1 command in command prompt.

Two system() calls, two shells executed.

If you want to run more than one command then use system() to execute a shell script. I know nothing about the Symbian OS, but I do believe that there should be some sort of command shell on it?

I am using Symbian OS, UIQ3.1SDK.

I just wan to know whether got any C++ code that are able to run more than 1 command in command prompt.

I am not sure. You may want to direct your question to some of the veteran posters here.

Regards,

Two system() calls, two shells executed.

If you want to run more than one command then use system() to execute a shell script. I know nothing about the Symbian OS, but I do believe that there should be some sort of command shell on it?

Hi,

The problem I facing is I can't run more than 1 command using the system() function. For example:

system("cd desktop\helloworld");
system("bldmake bldfiles winscw");

The two code will run in the different command prompt window, therefore, I am not able to build the files. I need the two command to run in the same command prompt window. Any suggestion?

Thanks in advance.

Regards,

Adrian

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.