Code::Blocks Forums

User forums => Help => Topic started by: moriluka on June 07, 2021, 06:57:37 pm

Title: Project not working when copying it to different pc
Post by: moriluka on June 07, 2021, 06:57:37 pm
Hey,

as the title suggests I've run into a little problem lately.

I'm using both a Win10 PC as well as a Laptop running Ubuntu 20.04 to code and I'm transferring the projects between these 2 via git.
Now the problem is that everytime I pull the git-repo and try to open and build the project in codeblocks i get tons of errors (i. e. "undefined reference to main", etc.). This isn't a big problem though because when i cut out all the code from the project, build and paste the code back into codeblocks it works exactly like how it's supposed to.

My question is, is this generally a problem in codeblocks or is it a problem on my end? And if it's the latter is there any known cause (or in turn solution) to this problem?

Please excuse me if this is a dumb question, but as someone who has used codeblocks for less than a week it seems a little weird.

Thanks in advance,
Moritz
Title: Re: Project not working when copying it to different pc
Post by: stahta01 on June 07, 2021, 07:16:15 pm
It is not a normal problem to have.
So, you likely did something wrong.

Post a build log.

Possible link; my internet is not responding with the link either the server or my end is having issues.
https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

WARNING: Do not add *.depend to git it is not considered the proper thing to do. I have no idea if doing that could cause this issue.

Tim S.
Title: Re: Project not working when copying it to different pc
Post by: oBFusCATed on June 07, 2021, 07:19:43 pm
Do you have you executable and object files (.objs folder) in the git repo?
If you have them this would explain the strange behaviour.
Does a full rebuild (Build -> Rebuild) fix the problem?
Title: Re: Project not working when copying it to different pc
Post by: moriluka on June 08, 2021, 08:09:36 pm
Hey thanks for the replies.

@oBFusCATed: ty that seemed to be the problem. I had to tamper with the .gitattributes file to be able to transfer the exe via git.

Now I feel dumb for not looking for something like that myself
Title: Re: Project not working when copying it to different pc
Post by: oBFusCATed on June 08, 2021, 08:30:04 pm
Storing the exe in git is generally not a good idea. Git is not good at handling binary files.
If you want to share the exe and object files, make sure to have different folders for different OSes.
Title: Re: Project not working when copying it to different pc
Post by: moriluka on June 10, 2021, 06:09:48 pm
thanks for the heads up. i put all executables in the gitignore now. didnt know that was problematic in git
Title: Re: Project not working when copying it to different pc
Post by: stahta01 on June 10, 2021, 06:44:15 pm
thanks for the heads up. i put all executables in the gitignore now. didnt know that was problematic in git

It is normal to not put any generated binaries under direct version control.
Note: People sometimes put binaries tools needed to build the project under version control.
And, when you make a release the generated binaries are part of the release under Git (I have yet to do this myself; so, I could be wrong).
In git, it appears to be standard to create an git tag as part of doing a release.

Tim S.