Author Topic: Project not working when copying it to different pc  (Read 6257 times)

Offline moriluka

  • Single posting newcomer
  • *
  • Posts: 3
Project not working when copying it to different pc
« 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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Project not working when copying it to different pc
« Reply #1 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

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.
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: Project not working when copying it to different pc
« Reply #2 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?
(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 moriluka

  • Single posting newcomer
  • *
  • Posts: 3
Re: Project not working when copying it to different pc
« Reply #3 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Project not working when copying it to different pc
« Reply #4 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.
(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 moriluka

  • Single posting newcomer
  • *
  • Posts: 3
Re: Project not working when copying it to different pc
« Reply #5 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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Project not working when copying it to different pc
« Reply #6 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. 
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