Author Topic: Code blocks acting very weird.  (Read 14013 times)

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Code blocks acting very weird.
« on: November 12, 2011, 03:23:25 pm »
I made a little c++ program in code blocks and sent the .exe to a friend.

He got the error: "program could not start, because libgcc_s_dw2-1.dll is missing on the computer.".

I searched on forums for help, but when I looked I didn't even seem to have that dll file, but I could run it....

I decided to uninstall codeblocks and reinstall it.

When I tried to run a cpp file from code blocks, I would then get the libgcc_s_dw2-1.dll is missing...
After a few uninstalls and reinstalls I decided to see if another IDE would work.

I installed Dec-C++ and it works, but I like Code Blocks 1000 times more than Dev-C++..

I once more installed Code blocks (with dev-cpp still installed) and now if I
press the compile and run - nothing happends. Nothing at all.

If I press the run button, it runs.
But if I make any changes to the code, it doesnt get affected.

If the code is: cout <<"Hello"
and then I change it to: cout <<"wasaa";
It would still output Hello.

EDIT:
If I press compile and run - nothing happends, and THEN run the regular CMD-like window will open.
If I close that window, another will pop up. When I close that, nothing happends.
« Last Edit: November 12, 2011, 03:26:16 pm by torchi12 »

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #1 on: November 12, 2011, 04:01:29 pm »
Can anyone help me?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Code blocks acting very weird.
« Reply #2 on: November 12, 2011, 04:04:55 pm »
He got the error: "program could not start, because libgcc_s_dw2-1.dll is missing on the computer.".
Well, you should have better tried to understand, what that means. The reason is that the compiler you are using creates executables that depend on that library as long as you don't statically link, which requires a single, simple compiler switch.

Instead, you uninstall/install IDE's whose compiler conflict and blame C::B afterwards that nothing works. In addition you don't mention what version of C::B you are using on what platform etc...

Well, that's the kind of stuff I really don't like and usually wouldn't even bother and probably even delete the post, however... here is a way out:

Uninstall both IDE's, make sure both install path's are really empty. Make sure the compiler is fully un-installed, check the PATH environment that DevC++ didn't leave references.

Clear the C::B settings, usually located in your user's home directory, or Application data (depending on your OS which you didn't mention this obviously varies). If unsure, search for a file named "default.conf" in your HDD's.

The install C::B from scratch - choose a nightly which has the compiler bundled. Make sure you setup the compiler correctly, especially check, it in the compiler settings the toolchain path is setup correctly.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #3 on: November 12, 2011, 04:42:08 pm »
Uninstalled both IDEs.

I'm on Windows 7, 32 bit.

Cleared the default.conf file.

"NOTE: There are also more recent nightly builds available in the forums or (for Debian users) in Jens' repository. Please note that we consider nightly builds to be stable, usually."
>Debian users<

Should I just download the codeblocks-10.05mingw-setup.exe?

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #4 on: November 12, 2011, 04:44:58 pm »
Oh, I misread.
"OR for Debian users"

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #5 on: November 12, 2011, 05:10:11 pm »
Installed a nightly according to instructions, but when I try to start up code blocks I get this error:

"
An exception has been raised!

The application encountered an error at
C:\CodeBlocks\branches\wxpropgrid_debugger\src\sdk\configmaneger.cpp, on line 233.
The error message is:

TinyXML error: Error document empty.
In file:
C:\Users\Usernaeem\Appdata\Roaming\CodeBlocks\default.conf
Ar row 0, column: 0

Code::Blocks version revision 7452 (gcc 4.5.2, build: Sep 4 2011)
"

Wouldn't it work with the normal install file? Instead of a nightly?
Or how do I fix this?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Code blocks acting very weird.
« Reply #6 on: November 12, 2011, 05:32:44 pm »
TinyXML error: Error document empty.
In file:
C:\Users\Usernaeem\Appdata\Roaming\CodeBlocks\default.conf
Interesting. I never had this one before. Can this folder be accessed by an application (Are the access rights OK?) Did you try to remove the file in question? You can safely remove the whole folder - all files will be re-created.

Concerning the nightlies - there is a special forum board ("Nightly builds") which can be found here: http://forums.codeblocks.org/index.php/board,20.0.html. Try this one:
http://forums.codeblocks.org/index.php/topic,15439.msg103638.html#msg103638
...but read carefully the statements given there. Notice that for a nightly you will need a compiler, try one of these:
http://tdm-gcc.tdragon.net/download
...which ships with an installer, so nothing can go wrong usually. Just pick the right one for you platform which matches your development needs. This is the same compiler we use for development.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #7 on: November 12, 2011, 05:34:47 pm »
I removed the default.conf file and the folder it was it.
Code blocks started up fine.

Although my original problem still exists.

Pressing compile and run does absolutely nothing.
Pressing run will run the file - but I can't change stuff in it and then compile and run.

and if i press compile and run , and then run, it will open the regular CMD-like window, when i close it, it opens another one.
If i close that one, no more show up.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Code blocks acting very weird.
« Reply #8 on: November 12, 2011, 05:35:50 pm »
BTW: As you said Windows7: I am pretty sure that the compiler shipping with C::B 10/05 is too old for Windows 7. You you will need to use a more recent compiler anyways, so don't install C::B 10/05 including a compiler.
« Last Edit: November 12, 2011, 05:38:37 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #9 on: November 12, 2011, 05:39:13 pm »
Uhm, are you saying I can not use Code Blocks?
Under version it says: svn build rev 7452.

Also I didn't check that the toolchain thing was set up correctly.
Will do now

zabzonk

  • Guest
Re: Code blocks acting very weird.
« Reply #10 on: November 12, 2011, 05:42:24 pm »
I have to say that I disagree with Morten's advice on using a nightly. Here is what I would do:

Uninstall Code::Blocks and everything to do with it, ditto for Dev C++. Make sure you haven't got any other instances of the GCC compiler sitting on your path. Use a tool lke Everything from http://www.voidtools.com to check this.

Install GCC from TDM - see http://latedev.wordpress.com/2011/06/20/how-to-install-a-c-compiler-on-windows for details. Check that you can build, link and execute simple C++ programs from the command line using this. If not, go no further until you can do this.

Install the 10.x build of Code::Blocks without the GCC compiler (that's codeblocks-10.05-setup.exe at the http://www.codeblocks.org/downloads/binaries page), not from a nightly.

Once installed, run Code::Blocks and set the toolchain to point to the previously installed GCC compiler via the Settings|Compiler & Debugger|Toolchain dialog. Test this works. If it does not work,. DO NOT uninstall, DO NOT install something else. Try and work out why it does not work, and if necessary post here. The worst thing you can do if something isn't working is to start flailing about without knowing what you are doing. Think!

Once you have got things working, you can (optionally) install a nightly. I normally do this by unzipping it over a working instrallation (having backed up the working installation, of course).


Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #11 on: November 12, 2011, 05:47:48 pm »
Hm, ok, will try that.

Going to uninstall and remove everything now, then.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Code blocks acting very weird.
« Reply #12 on: November 12, 2011, 05:48:25 pm »
Once you have got things working, you can (optionally) install a nightly. I normally do this by unzipping it over a working instrallation (having backed up the working installation, of course).
?!  Overwriting an installation with a different version can wreak havoc.

zabzonk

  • Guest
Re: Code blocks acting very weird.
« Reply #13 on: November 12, 2011, 05:49:37 pm »
@Alpha It's always worked for me! But I suspect that the OP will be happy to get CB working, without worrying about installing nightlies.

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #14 on: November 12, 2011, 06:19:25 pm »
Thank you so much, it seems to be working now!

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #15 on: November 12, 2011, 06:30:01 pm »
I have a question, though...

My friend is not online right now, so I cant test it, but wouldn't he still be getting that error?

And another question is..
Why am I not getting the error? I looked, and I don't seem to have that file ; |

zabzonk

  • Guest
Re: Code blocks acting very weird.
« Reply #16 on: November 12, 2011, 06:38:57 pm »
Console application executables built with the TDM compiler I suggested you download do not normally require any extra DLLs - I have  several FOSS projects built with TDM that consist of nothing but the executable. Why your original executable had that dependency - who can say? You should really check your executables for dependencies using a tool like Dependency Walker from http://www.dependencywalker.com before distributing them.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Code blocks acting very weird.
« Reply #17 on: November 12, 2011, 07:19:03 pm »
I suggest removing all installed files before unzipping the nightly, otherwise you can get errors due to the use of incorrect libraries.
If I remember correctly there have been changes that can probably lead to errors.

Offline torchi12

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code blocks acting very weird.
« Reply #18 on: November 12, 2011, 07:20:28 pm »
How does it really work though?
I got this:
http://imageshack.us/photo/my-images/714/hmeee.png/
« Last Edit: November 12, 2011, 07:23:03 pm by torchi12 »

zabzonk

  • Guest
Re: Code blocks acting very weird.
« Reply #19 on: November 12, 2011, 07:22:33 pm »
Explaining the output of Dependency Walker would be waaaaay off-topic here. As I remember, its help is quite good - read it.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Code blocks acting very weird.
« Reply #20 on: November 12, 2011, 07:35:35 pm »
@Alpha It's always worked for me!
I suggest removing all installed files before unzipping the nightly, otherwise you can get errors due to the use of incorrect libraries.
If I remember correctly there have been changes that can probably lead to errors.
@Neil This is what I had been referring to (although, depending on the program, it is possible there could be no errors; but that would just be luck).

zabzonk

  • Guest
Re: Code blocks acting very weird.
« Reply #21 on: November 12, 2011, 07:43:29 pm »
@Alpha & Jens

I retract my advice!