Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Help with first C++ Program
Help with first C++ Program [message #998137] Wed, 09 January 2013 12:32 Go to next message
Jayanth D is currently offline Jayanth D
Messages: 16
Registered: December 2012
Junior Member
Hello!

I installed Eclipse C/C++ IDE Juno and MinGW Compiler tools. I created a Hello World C Program and it worked. Then I created a C++ Program for Hello World. It builds without errors but when the program is run inside eclipse it doesn't output anything. Below is the C++ code. Help me with the issue.

#include <iostream>
using namespace std;

int main(void) {

	cout << "Hello! C++" << endl;
	return 0;
} 


Edit: I tried to run the compiled file from Command Prompt but I get the error message libgcc_s_dw2-1.dll missing but I can see the file present in the MinGW/bin folder.

I also tried reinstalling eclipse c/C++ ide and MinGW but it is of no use. Can somebody solve the problem?

[Updated on: Wed, 09 January 2013 14:08]

Report message to a moderator

Re: Help with first C++ Program [message #1000385 is a reply to message #998137] Mon, 14 January 2013 16:21 Go to previous messageGo to next message
Cong Chen is currently offline Cong Chen
Messages: 6
Registered: January 2013
Junior Member
project properties -> C/C++ Build -> Settings -> MinGW C++ Linker -> Misc
add libgcc_s_dw2-1.dll to "linker flags"
Re: Help with first C++ Program [message #1000709 is a reply to message #1000385] Tue, 15 January 2013 09:56 Go to previous messageGo to next message
Jayanth D is currently offline Jayanth D
Messages: 16
Registered: December 2012
Junior Member
Hi! Cong Chen. Thanks for replying. I did as you said (see the attached image) but still the .exe file in the release folder of the project doesnt output any messages. If I debug the .exe in the debug folder of the project it produces the desired output.
Re: Help with first C++ Program [message #1000771 is a reply to message #1000709] Tue, 15 January 2013 12:12 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1949
Registered: July 2009
Senior Member
Jayanth D wrote on Tue, 15 January 2013 10:56
Hi! Cong Chen. Thanks for replying. I did as you said (see the attached image) but still the .exe file in the release folder of the project doesnt output any messages. If I debug the .exe in the debug folder of the project it produces the desired output.

Your program needs libgcc_s_dw2-1.dll to run.
You have 3 choices
- copy libgcc_s_dw2-1.dll to the folder with your executable
- copy libgcc_s_dw2-1.dll to a folder that is in your PATH env variable (or add the folder it rersides in to PATH)
- build your program with static gcc lib (you can google for the solution)


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Help with first C++ Program [message #1000994 is a reply to message #1000771] Tue, 15 January 2013 20:45 Go to previous messageGo to next message
Jayanth D is currently offline Jayanth D
Messages: 16
Registered: December 2012
Junior Member
I tried the first option but it did not work. I copied the dll to the Release folder of the project.

I copied libgcc_s_dw2-1.dll to Projects Release folder and then ran the .exe from DOS prompt. It asked for another file libstdc++-6.dll. I put that also in the Release folder and ran the .exe from the dos prompt and I got the output but it doesn't work in the eclipse C/C++ IDE's console.

[Updated on: Tue, 15 January 2013 20:50]

Report message to a moderator

Re: Help with first C++ Program [message #1115750 is a reply to message #1000994] Tue, 24 September 2013 14:30 Go to previous messageGo to next message
Shahid Mehmood is currently offline Shahid Mehmood
Messages: 2
Registered: September 2013
Location: London
Junior Member
Same Problem - same line of enquiry Confused
Re: Help with first C++ Program [message #1115778 is a reply to message #1115750] Tue, 24 September 2013 15:17 Go to previous message
Alex Petrov is currently offline Alex Petrov
Messages: 5
Registered: September 2013
Junior Member
Same Problem - same line of enquiry Confused
+1
Previous Topic:Split Views in Eclipse 4.2 (Juno)
Next Topic:Setting correct build path
Goto Forum:
  


Current Time: Tue Sep 16 17:43:41 GMT 2014

Powered by FUDForum. Page generated in 0.04272 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software