0

I'm trying to run my program with MinGW compiler through batch file. But when I try to launch it, it says nothing.

Here is a code:

g++ -o Learning.exe Main.o 
pause

When I just opening .exe file, it working perfectly. How to fix that?

1
  • The purposed script doesn't actually run your application, it just links it. Commented Aug 31, 2012 at 12:01

1 Answer 1

3

GCC is silent if there aren't any issues, errors or warnings.

Do you want to run the actual program you created? Right now you just link it.

To compile and run if there weren't any issues, you can use the following:

g++ main.cpp -o learning.exe && learning.exe
pause

The part behind && won't be executed, unless there haven't been any error during compilation (return value not being 0).

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you, but did you know, how to connect output to the IDE (Eclipse)? Simply change path to my .bat file?
Create a new C++ project in Eclipse. That's a lot easier to use than some makefile/batch project.
Where is makefile/batch project? =/
When creating a new project, you can make a "makefile project". That won't accept a batch file to build though. Make sure you've got the C++ extensions (CDT) installed (vanilla Eclipse will only allow you to create Java projects).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.