Announcement

Collapse
No announcement yet.

Git Repository with only the Essentials

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Git Repository with only the Essentials

    I was setting up a Git repository and had some trouble with Visual Studio's build files. I initially added all files to the git repository expecting anyone to be able to open my Visual Studio solution (.sln) file so my team can compile their code. That was silly of me, considering Visual Studio sets up a lot of Computer specific references and running a VS Solution file that was not made on your computer confuses Visual Studio.

    So when I setup my git repository I only included the following:
    • Binaries/Win64/UE4Editor-Test123.dll
    • Config
    • Content
    • Source
    • Test123.uproject


    This allows me to open the Test123.uproject in the Unreal Editor then select "Add Code to Project" which generates a Visual Studio Solution and the "Intermediate" directory that contains several Visual Studio build files. However when I attempt to compile this Solution it gives the following errors:

    Code:
    Error	1	error LNK1104: cannot open file 'C:\Users\Flip\Documents\Unreal Projects\Test123\Binaries\Win64\UE4Editor-Test123.dll'	C:\Users\Flip\Documents\Unreal Projects\Test123\Intermediate\ProjectFiles\LINK	Test123
    Error	2	error : Failed to produce item: C:\Users\Flip\Documents\Unreal Projects\Test123\Intermediate\Build\Win64\Test123Editor\Development\UE4Editor-Test123.exp	C:\Users\Flip\Documents\Unreal Projects\Test123\Intermediate\ProjectFiles\ERROR	Test123
    Error	3	error MSB3073: The command ""C:\Program Files\Unreal Engine\4.0\Engine\Build\BatchFiles\Build.bat" Test123Editor Win64 Development "C:\Users\Flip\Documents\Unreal Projects\Test123\Test123.uproject" -rocket" exited with code -1.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	38	5	Test123
    Though if I close Visual Studio/Unreal Editor and compile again it Builds fine. So my question is how can I only include my Config, Content, and Source while being able to open in Unreal Editor and compile in Visual Studio (without doing the round-about steps above)?

    #2
    Do you know the file .gitignore? So, its role is just to solve problems like yours.

    Take a deeper look just right here.
    Give me something to believe in.

    Comment


      #3
      Did you have the Editor open when you initially attempted to compile the code in VS?
      Also, while it's not related to the error you really shouldn't be putting UE4Editor-Test123.dll into your git repo.
      Contact: enlight in #unrealengine IRC channel on Freenode, or @macagonator on Twitter

      Comment


        #4
        Originally posted by chiefGui View Post
        Do you know the file .gitignore? So, its role is just to solve problems like yours.
        Take a deeper look just right here.
        I am using the gitignore file to exclude the remaining files from being added to my repository. That's not my issue though, it is the fact I cannot create a Visual Studio .sln file with the source files.

        Originally posted by enlight_2014 View Post
        Did you have the Editor open when you initially attempted to compile the code in VS?
        Also, while it's not related to the error you really shouldn't be putting UE4Editor-Test123.dll into your git repo.
        I'm not sure if I had the Editor open, I will try again with it closed on the initial compile. Also, I only have the .dll files in the repository so my .uproject will continue to work. Should I not include the .dlls or the .uproject?

        Also, thank you both for your help!

        Comment


          #5
          Originally posted by Hagg View Post
          I'm not sure if I had the Editor open, I will try again with it closed on the initial compile. Also, I only have the .dll files in the repository so my .uproject will continue to work. Should I not include the .dlls or the .uproject?
          If you had the Editor open while trying to compile your project then it would explain why Visual Studio couldn't overwrite the .dll at the end of the build process. You shouldn't include the UE4Editor-Test123.dll in your git repo because it's the output of the build process, it will be rebuilt from the source as necessary. The .uproject should be in your git repo. The .sln/.sdf/.suo should not as they can be regenerated from the .uproject. More details on what to include and what to exclude from your git repo can be found here.
          Contact: enlight in #unrealengine IRC channel on Freenode, or @macagonator on Twitter

          Comment


            #6
            Ugly Answer

            I believe I did have the Editor open when I attempted to compile. I did the following to test:
            1. Created a New Project in Unreal Editor
            2. Compiled with Visual Studio
            3. Removed files (all but the Binaries, Content, Source, and .uproject)
            4. Opened the Unreal Editor on the .uproject
            5. Selected "Add Code to Project" (Added a random class because this recreates/adds a Visual Studio Solution to the Project)
            6. Selected Yes to edit the code
            7. Once Visual Studio opened, closed the Unreal Editor
            8. Compiled the project in Visual Studio and it built successfully


            This means I can store the files from my original post in my git directory and have my team run through steps 4-8 whenever they clone the repo. This can't be the best way to setup a Visual Studio solution for UE4 but, it's the best way I've found this far.

            Comment


              #7
              Originally posted by Hagg View Post
              This means I can store the files from my original post in my git directory and have my team run through steps 4-8 whenever they clone the repo. This can't be the best way to setup a Visual Studio solution for UE4 but, it's the best way I've found this far.
              Actually if your team just needs to build the project as opposed to adding new files to it they just need to do this:
              1. Right-click on the .uproject file and select Generate Visual Studio Files.
              2. Double-click the .sln that was generated in step 1 to open it in Visual Studio.
              3. Compile the project in Visual Studio.


              If you add new source files to your project outside the Editor you'll need to regenerate the Visual Studio files by repeating step 1.
              Contact: enlight in #unrealengine IRC channel on Freenode, or @macagonator on Twitter

              Comment


                #8
                Originally posted by enlight_2014 View Post
                Actually if your team just needs to build the project as opposed to adding new files to it they just need to do this:
                1. Right-click on the .uproject file and select Generate Visual Studio Files.
                2. Double-click the .sln that was generated in step 1 to open it in Visual Studio.
                3. Compile the project in Visual Studio.


                If you add new source files to your project outside the Editor you'll need to regenerate the Visual Studio files by repeating step 1.
                So simple >.< and i was doing binery coping and class creation workaround.... thanks for info ^^

                Thru i think would be more obviues if editor detect source files and propose project generation when there no bineries
                =========
                My Tutorials:
                Basic knowledge about Classes and UObject environment and stuff like that

                Comment


                  #9
                  Originally posted by enlight_2014 View Post
                  Actually if your team just needs to build the project as opposed to adding new files to it they just need to do this:
                  1. Right-click on the .uproject file and select Generate Visual Studio Files.
                  2. Double-click the .sln that was generated in step 1 to open it in Visual Studio.
                  3. Compile the project in Visual Studio.


                  If you add new source files to your project outside the Editor you'll need to regenerate the Visual Studio files by repeating step 1.
                  You sir are amazing, this is exactly what I needed. Thank you for sticking it out and helping me!

                  Comment


                    #10
                    Click image for larger version

Name:	1.png
Views:	1
Size:	15.3 KB
ID:	1050528

                    I am getting this error while I try to generateProjectFiles. Any idea how I can fix it.

                    I could successfully compile when I downloaded the source zip file.

                    When I forked and copied I am getting error. Something to do with .gitignore but I got no idea about it.
                    Last edited by Shomit; 05-09-2014, 12:20 AM.

                    Comment

                    Working...
                    X