Author Topic: Fail to run executable  (Read 4747 times)

Offline thaumiel

  • Single posting newcomer
  • *
  • Posts: 3
Fail to run executable
« on: July 03, 2009, 06:25:22 am »
This is something simple, I am doing a small aplication for windows, and decided to use gtk. I found about Code::Blocks and decided to use it, its a great IDE, I just have one problem so far.

I downloaded gtk and added its route to the windows path, so now I can execute gtk aplications, I added gtk route to my project in Code::Blocks, so it compiles and link ok.

But when I click the run button, the aplication fails and a message says that it can not find libglib dll, but if I go to the project folder and run directly the executable, the aplication runs without problems.

I know its not big deal, but I would like to be able to build and run.

Any idea what the problem is?

Thanks in advance and I apologize for my english, I almost never write in english.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Fail to run executable
« Reply #1 on: July 03, 2009, 06:55:34 am »
If on Windows, I suggest one of the following.

1. Copy the needed DLLs to the folder holding the executable
2. Adding the folder holding the needed DLLs to the Compiler's "Additional Path".

I prefer solution 1; no idea if these solutions are correct in a NON-Windows based system.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Fail to run executable
« Reply #2 on: July 03, 2009, 10:28:56 am »
stahta01: 1 and 2 are wrong with gtk, because there is gtk-runtime package, which is global for the system.

thaumiel:
Do you have the runtime package?
I have it (because I use pidgin for windows).
This package places the dlls in my C:\Program Files\Common Files\GTK\2.0\bin\ .
And there is a path entry about that.
So the dlls should be found automatically, if C::B respects the PATH environment variable.

The things I've said above are speculations/assumptions which I have not tested myself, so they might be wrong (you could try to find some official docs about the correct way of using gtk on windows)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thaumiel

  • Single posting newcomer
  • *
  • Posts: 3
Re: Fail to run executable
« Reply #3 on: July 03, 2009, 10:11:02 pm »
I solved my problem, well, it kind of solved by itself.

I downloaded the gtk boundle, it has the source code, and all the needed executables and dlls, after I added gtk directory to windows PATH, the gtk aplicatios could be executed.

Only Code:Blocks failed to execute when I launched them with the acctions run and, build and run of Code::Blocks.

The solution was, reboot. After this I was able to launch the executables from within Code::Blocks.

Thanks a lot to the people that answer my cuestion, I think I asked for help too soon, but I did not think that I would need to reboot since the builded aplication was able to run from the windows explorer.

Again thanks for the help and I apologize for my english.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Fail to run executable
« Reply #4 on: July 03, 2009, 11:11:52 pm »
This is because C::B sees the old PATH variable, it is not updated until the process is restarted (not sure if the shell (Explorer.exe) rereads it when the value changes)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Fail to run executable
« Reply #5 on: July 04, 2009, 10:00:51 am »
This is because C::B sees the old PATH variable, it is not updated until the process is restarted (not sure if the shell (Explorer.exe) rereads it when the value changes)

Explorer and cmd.exe normally does this, but C::B caches the environment at startup, so a restart of C::B is enough, you don't need to restart the system.

Offline thaumiel

  • Single posting newcomer
  • *
  • Posts: 3
Re: Fail to run executable
« Reply #6 on: July 04, 2009, 11:06:32 pm »
Thanks for your help, the problem its already solved, but what led me to belive I got a problem Its that even after I restart C::B it still would not find the dlls.

Again, thanks everybody for your time and help.