Gildor's Forums

Author Topic: Problems building code from Visual Studio  (Read 152 times)
Gildor
Administrator
Hero Member
*****
Posts: 7899



View Profile WWW
Re: Problems building code from Visual Studio
« Reply #15 on: October 03, 2020, 23:43 »

I can suggest installing Git for Windows (if you don't have one) and try using ITS bash, which is newer etc. If this will work, I'll update BuildTools (I'm using 2011 year bash!)

I just don't know your skills with using Git, command line etc - how deep explanation you'll need for doing that yourself?
Logged
Cyreal
Newbie
*
Posts: 15


View Profile
Re: Problems building code from Visual Studio
« Reply #16 on: October 03, 2020, 23:50 »

Well I've never used Git. As for Shell, I used it years ago in university when studying Operating Systems but I was pretty bad at it ;(

The Git for Windows has a million options in it's installer that I don't understand.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7899



View Profile WWW
Re: Problems building code from Visual Studio
« Reply #17 on: October 03, 2020, 23:58 »

Well, I've packed BuildTools with newer files from Git distribution. I can't test it myself because of some conflicts on the system (I'm not using "clean" BuildTools myself, I have multiple bash.exe on the system etc)

Files are here: https://drive.google.com/file/d/1dJqI14fzgQEGb-DcPEI1OYEbmpwl6yhf/view?usp=sharing
Logged
Cyreal
Newbie
*
Posts: 15


View Profile
Re: Problems building code from Visual Studio
« Reply #18 on: October 04, 2020, 00:11 »

Code:
>------ Build started: Project: tasks.vs, Configuration:  ------
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\.vs\bash.exe : warning : could not find /tmp, please create!
  bash: ./build.sh: No such file or directory

Build failed.

Well this is weird. If I open bash.exe in C:\Github\BuildTools-master\bin (which I replaced with the new files you sent) it says warning : could not find /tmp, please create!
Logged
Cyreal
Newbie
*
Posts: 15


View Profile
Re: Problems building code from Visual Studio
« Reply #19 on: October 04, 2020, 01:56 »

OK, I installed Git for Windows. When I go to UEViewer-master folder -> Right Click -> Git Bash here and type ./build.sh it builds... I think. But I don't know what to do next. It still won't build with Visual Studio. I tried with and without "./' in the json.

EDIT

Yes, I can confirm when I build it with Git Bash here and type ./build.sh it builds. I get the SDL2.dll and a Umodel.pdb file (which is used for instructing Visual Studio how to debug I think). The first time I built it I got a ton of .cpp files displayed and finally build time: 12.5 sec or something. Now when I build it again I only get:

Code:
$ ./build.sh
Visual Studio Community 2017 toolset 141 (14.12.25827) [32 bit] found at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" ...
Generating makefile from UmodelTool/umodel.project ...
jom ./obj/umodel-vc-win32.mak
Build time: 0.1 sec

But I still don't know how to build it in Visual Studio. I have 2 bash.exe files in the Git installation folder in different subfolders, I tried putting them in BuildTools-master\bin\ replacing your bash.exe but both don't work. If I try to open the bigger one (in size) it complains about a missing .dll, if I put the other it just flashes, it doesn't open. And neither of them work when trying to build from Visual Studio.
« Last Edit: October 04, 2020, 02:10 by Cyreal » Logged
Gildor
Administrator
Hero Member
*****
Posts: 7899



View Profile WWW
Re: Problems building code from Visual Studio
« Reply #20 on: October 04, 2020, 09:10 »

1. Remove all exe and dll files from BuildTools, so typing "bash" won't start them.
2. Put "C:\Program Files\Git\usr\bin" to PATH (or whatever directory where you've installed Git). Probably this path is already there - you may try.
3. Try starting "bash.exe" from CMD, see that bash started without a problem.
4. Clean up changes made to json files, try to build.
Logged
Cyreal
Newbie
*
Posts: 15


View Profile
Re: Problems building code from Visual Studio
« Reply #21 on: October 04, 2020, 22:37 »

3. Try starting "bash.exe" from CMD, see that bash started without a problem.

If by this you mean to open Windows Command Prompt, cd to C:\Program Files\Git\usr\bin and run bash.exe, then yes it works.

I emptied the BuildTools\bin folder, only have vs32tools and vsfilt, now.

Added C:\Program Files\Git\usr\bin to PATH.

However, in Visual Studio I still get:

Code:
>------ Build started: Project: Exporters, Configuration:  ------
  bash: build.sh: No such file or directory

Build failed.

I cleaned the JSON files. I tried with the "./" as well as "pwd", etc... but still it doesn't work. Same errors as before.  sad
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7899



View Profile WWW
Re: Problems building code from Visual Studio
« Reply #22 on: October 05, 2020, 09:39 »

What "pwd" says if you'll add it to the JSON? Would it indicate that current directory is UModel's one, or something different (e.g. like before - "pwd" points to /bin folder with bash.exe etc).

I can also suggest this. Open Git bash, type "mount" command. It will show correlation between Windows and Unix paths (bash is using a kind of Unix emulator). There should be all of your drives, e.g. "C:" should be mapped to "/c". If NOT - this emulator won't be able to run your code. I don't know when and how these mappings appears, I have them without any additional configuration.
Logged
Cyreal
Newbie
*
Posts: 15


View Profile
Re: Problems building code from Visual Studio
« Reply #23 on: October 05, 2020, 19:09 »

What "pwd" says if you'll add it to the JSON? Would it indicate that current directory is UModel's one, or something different (e.g. like before - "pwd" points to /bin folder with bash.exe etc).

Code:
>------ Build started: Project: Core, Configuration:  ------
  bash: pwd;build.sh: No such file or directory

Build failed.

I can also suggest this. Open Git bash, type "mount" command. It will show correlation between Windows and Unix paths (bash is using a kind of Unix emulator). There should be all of your drives, e.g. "C:" should be mapped to "/c". If NOT - this emulator won't be able to run your code. I don't know when and how these mappings appears, I have them without any additional configuration.

C: is indeed properly mapped to /c

I found out something weird though - since I built the code with Git Bash inside the source root folder and got the .dll and .pdb files, I went into the IDE, selected "No Arguments" and clicked to start debugging. Visual Studio opened a dialog box saying: "Build failed. Do you want to continue debugging?". If I click yes, I actually go into debug mode successfully, and can analyze the code step by step. In other words I can build the code with MINGW64 console and then run / debug it in VS. However this presents at least 2 problems that I am aware of:
1. Every time I make changes to the code, I'll have to rebuild it with MINGW64 console.
2. Because I am not building it inside Visual Studio, I get the problem I mentioned earlier - huge portion of the code gets underlined in red saying there are errors, even though there are no errors. Also syntax is not highlighted. To get rid of this problem I'd need to manually open each .h file that's included into the .cpp file I am viewing and then errors will start going away and syntax will get highlighted. But this is annoying since every .cpp file includes at least a couple of headers, so every time I decide to check the code inside a new .cpp I'll have to open all the headers I haven't opened already, that are included in it.  angry

So I guess this narrows the problem down to "Why am I able to build it with MINGW64 console, but not through Visual Studio?". I assume it has something to do with the JSON? If you open the JSON, do you get warnings inside the Error List tab? If you check my very first screenshot I posted in this topic you'll see I have 2 identical warnings. Right now I actually have 4 warnings, 2 by 2 identical:



Do you have those? Maybe they are causing the issue? I have no clue.  sad
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7899



View Profile WWW
Re: Problems building code from Visual Studio
« Reply #24 on: October 05, 2020, 19:23 »

Probably this is VS2017 problem which has been resolved in VS2019 - I'd prefer not installing VS2017 myself to test. I think I've added VS project when I already was with 2019 version.

Json has "working directory" option, and may be it didn't exist (or was configured in a different way) in 2017.
Logged
Cyreal
Newbie
*
Posts: 15


View Profile
Re: Problems building code from Visual Studio
« Reply #25 on: October 06, 2020, 02:01 »

I uninstalled VS 2017 and installed VS 2019. Just opened the code and built it. It built fine. I guess the problem was in VS 2017. Syntax is highlighted as it should be. Even better, Visual Studio 2019 uses more syntax highlighting than 2017, which I like. It seems the whole problem was in the IDE. Sorry for wasting your time, Gildor Embarrassed
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7899



View Profile WWW
Re: Problems building code from Visual Studio
« Reply #26 on: October 06, 2020, 10:03 »

I'm glad you've solved this. I'll update README.md about minimum VS version requirements.
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS