Author Topic: Fresh install of codeblocks seems to have messed up paths in some projects  (Read 14725 times)

Offline Vigor

  • Multiple posting newcomer
  • *
  • Posts: 10
I installed codeblocks 3 years ago but had an occasional bug that had been reported and now fixed so I reinstalled codeblocks.

Now some of my projects aren't working.  The really strange thing is that some, which are very similar still are.

The projects that aren't working are failing to find data files (images mostly) which are coded to have paths that lead from where the project file is.   From where the project file is, the executable is in /bin/debug/???.exe

I can also move the .exe to the folder the project file is in and everything works correctly.   I don't put the exe where it is, it shows up there after being compiled and, up until today, it worked fine from its compiled location or in the folder the project-workspace is in.

I have looked through project settings/compiler settings/etc and even made changes hoping to correct things but I'm afraid I will break other things if I keep trying to fix it on my own.

of 5 projects.
1. most used - doesn't get any data files or images loaded but works perfectly if I move the exe into the folder the project is in and execute it from file viewer
2. old version of the most used - works completely as if nothing happened
3. 2nd most used project - which edits image files.  It isn't loading data/image files either.
4. project that doesn't use images at all but does use data files appears to be working correctly
5. a project I wrote months ago and haven't touched since, which uses one large image file is not loading the image.   I had no reason to change it after it was working properly.

so 2 projects still work 3 don't

the  "bug" I was trying to fix by updating my codeblocks was one that told me the project was compiling when I tried to shut down codeblocks (but it wasn't compiling)  I suspect that could be the common denominator.   I might have gotten that bug on each of the programs that isn't working now the last time I had them open.  I used task manager to force quit codeblocks whenever I got the bug.   But then if i restarted it my programs worked normally before.   I got the bug the last time I tried to shut that program down.  Then I updated codeblocks.

this is the bug I was trying to fix
https://forums.codeblocks.org/index.php?topic=23952.0

Perhaps I should have put this in a bug reports section but I'm hoping there is a simple fix.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7606
    • My Best Post
Which nightly build of Code::Blocks did you install?

https://forums.codeblocks.org/index.php/board,20.0.html

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 Vigor

  • Multiple posting newcomer
  • *
  • Posts: 10
Version          : 20.03-r11983
is 11983 the nightly build?
My previous version was downloaded on Jan 20, 2022 - codeblocks-20.03-setup.exe

I checked the nightly build number before downloading the new version (on march 24, 2024) and I thought it started with a 2, as in 20000.   Would that mean I didn't successfully reinstall?

Does this mean I need to download wxwigits, winwm10.dll, and wxmsw28u_gcc_cb.dll and other things mentioned in the nightly build?

I also didn't "save" the download I just "opened" it(iirc, + it isn't in my downloads folder).   At that point i just accepted default options.

I got my updated version of codeblocks from this link
https://www.codeblocks.org/downloads/binaries/
and I think i chose the codeblocks-20.03mingw-setup.exe

i'm not positive of that.  I know I have a mingw folder where iirc i put my opengl.a files so it looks like that would be the right download.  c:\program files\codeblocks\mingw\include.   If not it was the codeblocks-20.03-setup.exe.

Offline Vigor

  • Multiple posting newcomer
  • *
  • Posts: 10
btw thank you for codeblocks and your help fixing this

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7606
    • My Best Post
Version          : 20.03-r11983
is 11983 the nightly build?

No, that was the last release and the link you posted was after that release; therefore, it does not have the fix you said you needed.

You need to follow the nightly build directions in link to use the Windows nightly build.

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 Vigor

  • Multiple posting newcomer
  • *
  • Posts: 10
OK, I think I got nightly builds figured out and downloaded.

I think it created a 2nd installation of codeblocks in my downloads folder and I had to move the other files extracted from the 7z files into that folder.

the version of the new installation of codeblocks now shows as
Name                    : Code::Blocks
Version                 : svn-r13493
SDK Version             : 2.25.0
Scintilla Version       : 3.7.5
Author                  : The Code::Blocks Team
E-mail                  : info@codeblocks.org
Website                 : https://www.codeblocks.org
OS                      : Windows 10 (build 19045), 64-bit edition
Scaling factor          : 1.000000
Detected scaling factor : 1.000000
Display PPI             : 96x96
Display count           : 1
Display 0 (\\.\DISPLAY1): XY=[0,0]; Size=[1920,1080]; Primary

wxWidgets Library (wxMSW port)
Version 3.2.4 (Unicode: wchar_t, debug level: 1),
compiled at Dec  9 2023 17:38:11

Runtime version of toolkit used is 10.0.

It loads my most recent workspace/project but running the project still has the same path issue so that none of my images or data files are loading.

When I re-downloaded the 20.03, that was not a nightly build right?   So I effectively installed one version of codeblocks on top of an identical version?

I think that is how i got the path problem.   I actually tried to reinstall twice thinking something went wrong the first time.

The bug i was originally trying to fix was not particularly important.  It was more of a nuisance I usually wasn't bothered by.   The path problem is a bigger problem.   I would be happy to uninstall codeblocks and reinstall if I thought that would fix it but I am afraid it won't.  If I did reinstall I'm afraid I might then need to reinstall opengl files or gcc files too.

I could also maybe work around this by moving my data files to the debug folder or maybe the bin folder.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7606
    • My Best Post
Is the new problem a build issue or a run-time issue?

If build issues post a full rebuild log.
If run-time post the build log after it fails running.

Edit add link to FAQ https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.
« Last Edit: March 27, 2024, 01:09:04 pm by stahta01 »
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 Vigor

  • Multiple posting newcomer
  • *
  • Posts: 10
I don't think it is either.

As I said in the beginning, it compiles fine and runs fine IF I move the generated executable from the default location to the location of the project/workspace file .cbp

But normally I don't need to move the executable.    If I were to create a new codeblocks project today, and compile it, the executable would be in BASEFOLDER/bin/debug/executable.exe where BASEFOLDER=the origin of the .cbp file.

Then, while launching from codeblocks, the exe would launch as if it were in the same folder as the .cbp

If I wanted to run the exe WITHOUT codeblocks, I would need to move it to the same folder as the .cbp because the relative paths to data and image files would be broken from its compiled location.

In other words, the codeblock environment normally fudges the path to make the executable behave as if it were somewhere else (for convenience) and it isn't currently doing that.

but here is the build log

-------------- Clean: Debug in Colonize2 (compiler: GNU GCC Compiler)---------------

Cleaned "Colonize2 - Debug"

-------------- Build: Debug in Colonize2 (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\316Block.cpp" -o obj\Debug\316Block.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\Cities.cpp" -o obj\Debug\Cities.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\ColBlock.cpp" -o obj\Debug\ColBlock.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\ColBlockView.cpp" -o obj\Debug\ColBlockView.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\helper.cpp" -o obj\Debug\helper.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\main.cpp" -o obj\Debug\main.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\Map.cpp" -o obj\Debug\Map.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\MapView.cpp" -o obj\Debug\MapView.o
C:\Parse Project\Greenville\Colonize2\316Block.cpp: In member function 'std::__cxx11::string Block316::IndexNames(int)':
C:\Parse Project\Greenville\Colonize2\316Block.cpp:344:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
C:\Parse Project\Greenville\Colonize2\Cities.cpp: In member function 'bool Cities::IsCity(int, int)':
C:\Parse Project\Greenville\Colonize2\Cities.cpp:285:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < cities.size(); i++)
                    ~~^~~~~~~~~~~~~~~
C:\Parse Project\Greenville\Colonize2\Map.cpp: In member function 'void CMap::DrawCities()':
C:\Parse Project\Greenville\Colonize2\Map.cpp:352:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < cities->cities.size(); i++)
                    ~~^~~~~~~~~~~~~~~~~~~~~~~
C:\Parse Project\Greenville\Colonize2\Map.cpp: In member function 'void CMap::DrawUnits()':
C:\Parse Project\Greenville\Colonize2\Map.cpp:810:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < punits->units.size(); i++)
                    ~~^~~~~~~~~~~~~~~~~~~~~~
C:\Parse Project\Greenville\Colonize2\Map.cpp: In member function 'bool CMap::IsCity(int, int)':
C:\Parse Project\Greenville\Colonize2\Map.cpp:1004:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < cities->cities.size(); i++)
                    ~~^~~~~~~~~~~~~~~~~~~~~~~
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\NatBlock.cpp" -o obj\Debug\NatBlock.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\NatSetts.cpp" -o obj\Debug\NatSetts.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\Slider.cpp" -o obj\Debug\Slider.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\stb_image.cpp" -o obj\Debug\stb_image.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\TexFont.cpp" -o obj\Debug\TexFont.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\Texture.cpp" -o obj\Debug\Texture.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\Units.cpp" -o obj\Debug\Units.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\UnitView.cpp" -o obj\Debug\UnitView.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\View.cpp" -o obj\Debug\View.o
g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c "C:\Parse Project\Greenville\Colonize2\Views.cpp" -o obj\Debug\Views.o
g++.exe -L"C:\Program Files\CodeBlocks\MinGW\lib" -o bin\Debug\Colonize2.exe obj\Debug\316Block.o obj\Debug\Cities.o obj\Debug\ColBlock.o obj\Debug\ColBlockView.o obj\Debug\helper.o obj\Debug\main.o obj\Debug\Map.o obj\Debug\MapView.o obj\Debug\NatBlock.o obj\Debug\NatSetts.o obj\Debug\Slider.o obj\Debug\stb_image.o obj\Debug\TexFont.o obj\Debug\Texture.o obj\Debug\Units.o obj\Debug\UnitView.o obj\Debug\View.o obj\Debug\Views.o   -lglfw3 -lglfw3dll -lopengl32
C:\Parse Project\Greenville\Colonize2\UnitView.cpp: In member function 'void UnitView::Draw()':
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:42:12: warning: enumeration value 'UV_OLD' not handled in switch [-Wswitch]
     switch (uvt)
            ^
C:\Parse Project\Greenville\Colonize2\UnitView.cpp: In member function 'void UnitView::DrawUnit()':
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:83:15: warning: enumeration value 'DT_OCCUPATION' not handled in switch [-Wswitch]
         switch(dt[z])
               ^
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:83:15: warning: enumeration value 'DT_SPECIALTY' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:83:15: warning: enumeration value 'DT_TIMEINSLOT' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:83:15: warning: enumeration value 'DT_LG4BIT' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\UnitView.cpp: In member function 'int UnitView::GetDTSize(DataType)':
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:155:11: warning: enumeration value 'DT_UNITTYPE' not handled in switch [-Wswitch]
     switch(d)
           ^
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:155:11: warning: enumeration value 'DT_VOID' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\UnitView.cpp: In member function 'void UnitView::Keyboard(int, int, int)':
C:\Parse Project\Greenville\Colonize2\UnitView.cpp:232:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(active == un1.units.size())
                ~~~~~~~^~~~~~~~~~~~~~~~~~~
C:\Parse Project\Greenville\Colonize2\Views.cpp: In member function 'void Views::Draw()':
C:\Parse Project\Greenville\Colonize2\Views.cpp:15:12: warning: enumeration value 'V_NAT' not handled in switch [-Wswitch]
     switch (cur)
            ^
C:\Parse Project\Greenville\Colonize2\Views.cpp:15:12: warning: enumeration value 'V_CTV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:15:12: warning: enumeration value 'V_B3V' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:15:12: warning: enumeration value 'V_NSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:15:12: warning: enumeration value 'V_MSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp: In member function 'void Views::Keyboard(int, int, int)':
C:\Parse Project\Greenville\Colonize2\Views.cpp:36:15: warning: enumeration value 'V_NAT' not handled in switch [-Wswitch]
         switch(cur)
               ^
C:\Parse Project\Greenville\Colonize2\Views.cpp:36:15: warning: enumeration value 'V_CTV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:36:15: warning: enumeration value 'V_B3V' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:36:15: warning: enumeration value 'V_NSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:36:15: warning: enumeration value 'V_MSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp: In member function 'void Views::Mouse(int, int, int)':
C:\Parse Project\Greenville\Colonize2\Views.cpp:57:11: warning: enumeration value 'V_NAT' not handled in switch [-Wswitch]
     switch(cur)
           ^
C:\Parse Project\Greenville\Colonize2\Views.cpp:57:11: warning: enumeration value 'V_CTV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:57:11: warning: enumeration value 'V_B3V' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:57:11: warning: enumeration value 'V_NSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:57:11: warning: enumeration value 'V_MSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp: In member function 'void Views::MouseMove()':
C:\Parse Project\Greenville\Colonize2\Views.cpp:72:11: warning: enumeration value 'V_NAT' not handled in switch [-Wswitch]
     switch(cur)
           ^
C:\Parse Project\Greenville\Colonize2\Views.cpp:72:11: warning: enumeration value 'V_CTV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:72:11: warning: enumeration value 'V_B3V' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:72:11: warning: enumeration value 'V_NSV' not handled in switch [-Wswitch]
C:\Parse Project\Greenville\Colonize2\Views.cpp:72:11: warning: enumeration value 'V_MSV' not handled in switch [-Wswitch]
Output file is bin\Debug\Colonize2.exe with size 2.11 MB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 33 warning(s) (0 minute(s), 3 second(s))
 

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7606
    • My Best Post
Did you try adjusting the working folder for the CB Project?

Edit: Add steps to adjust working folder for target
With project open
Menu: Project -> Properties..
Tab: Build Targets
Select target to be changed
Change "Execution working dir" value

Tim S.
« Last Edit: March 27, 2024, 03:27:35 pm by stahta01 »
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 Vigor

  • Multiple posting newcomer
  • *
  • Posts: 10
THANK YOU!

That fixed it, somehow the working directory on the projects that are failing to load data files got changed to C:\Program Files\CodeBlocks\MinGW\bin

And the projects that continued working correctly had a working directory of .     Just a single period.