MinGW Compiler Errors - How do I setup the MSYS bat? - c++

I'm running Windows 8.
I installed the MinGW compiler to the default C:\ directory using the GUI installer. I selected to install all the elements available in the Basic Setup package of the MinGW Installation Manager.
After the installation completed, I checked that "C:/MinGW/msys/1.0/etc/fstab" had the one line of C:/MinGW /mingw and an open line beneath it. I also created a shortcut to msys.bat in the Start menu.
Then I rebooted my machine.
I created a folder called "CompileBin" in the C:\ directory, so C:\CompileBin\ and then I placed my test.cpp file inside, so C:\CompileBin\test.cpp
I ran msys.bat and the console opened up. It showed:
MyName,#MyLaptopsName ~
$
I started to navigate to where my test.cpp is:
cd c:\CompileBin\
Now the prompt looked like this:
MyName,#MyLaptopsName ~
$ cd c:\CompileBin\
>
I entered the dir command to look around and got the response:
MyName,#MyLaptopsName ~
$ cd c:\CompileBin\
> dir
sh: cd: c:CompileBindir: No such file or directory
Okay, so I figured maybe the path wasn't set up.
I added PATH to the Environment Variables (because it was NOT originally there) and gave it the value C:\MinGW\bin;
I still get the same error.

Unix tooling requires forward slashes in path names. It is cd c:/CompileBin

Related

VS remote building: "Makefile.Targets error: Cannot copy file remotely to directory"

I'm working on a Makefile project on Visual Studio, modifying code from my laptop and remotely building on a Linux server which i connect to via ssh.
I configured my project Property pages as such:
General: https://i.stack.imgur.com/3WdP6.png
Debugging: https://i.stack.imgur.com/zI5ua.png
Remote Build > Build command line: cd $(RemoteProjectDir) && echo password |sudo -S make
In the remote project directory i have already every file of the project, Makefile too. When pressing Compile i expect VS to copy the changed code from the local directory, file by file, to the remote one, but the only error i get is this:
Linux.Makefile.Target(108,5): error : Cannot copy \foo\bar\file.cpp remotely to /home/user/projects/MyProject/file.cpp
At line 108 of the file with target extension there is this tag:
<CopySources
Sources ="#(FinalSourcesToCopyRemotely)"
AdditionalSources="#(AdditionalSourcesToCopyRemotely)"
ProjectDir="$(ProjectDir)"
RemoteProjectDir="$(RemoteProjectDir)"
RemoteTarget="$(ResolvedRemoteTarget)"
IntermediateDir="$(IntDir)"
RemoteProjectDirFile="$(RemoteProjectDirFile)"
UpToDateFile="$(CopySourcesUpToDateFile)"
LocalRemoteCopySources="$(LocalRemoteCopySources)">
<Output TaskParameter="ResolvedRemoteProjectDir" PropertyName="_ResolvedRemoteProjectDir" />
</CopySources>
Can this file be the cause of the problem for some reason? Is it good to tinker with a .targets file?
I've already remotely build another project before with same configurations and similar Makefile (adapted for paths and file names) and it worked just fine.
[EDIT]:i've added the command echo password| sudo -S make to interact with the password request prompted by sudo, this worked in the other project and i still get the error
You can't use sudo when debugging . So I'd guess you can't use sudo when building either. The problem is sudo prompts for a password and VSLinux can't handle that. One option is to configure sudo so it doesn't request a password but that's not advised. Can you change your setup so it doesn't require sudo?
Long story short: if you get this error, just create another project with the same exact property as the first one, that'll do.
The problem was probably due to the fact that I changed the property several times before using the right one, which could have created some configuration (-ish) file, unchanged after the modifications.

F# package for Sublime Text Build System absent

I am starting out with F# and trying to get it to work with Sublime Text 3 with a package, https://github.com/fsharp/sublime-fsharp-package. After installing the package using Package Control, I see F# appear as an available language to use in Sublime Text's bottom bar, and syntax highlighting appears to work more or less, from what I can tell, but the build system for F# fails to appear as it should.
So, trying to fix things, I run "build.sh install" and get an error, "Cannot open assembly '.paket/paket.bootstrapper.exe': No such file or directory." I am sort of stuck. Many thanks for any help.
From the comments you've made, you appear to be a little unfamiliar with the Unix underpinnings of OS X. I'll explain those first, then I'll suggest something for you to try that may fix your problem.
Technically, files or directories whose name starts with . are not "reserved for the system" as you put it; they're hidden. Now, it's true that Finder won't allow you to create files or directories whose name starts with ., because Apple didn't want to have to field all the tech-support calls from people who didn't know about the hidden-files feature: "I named my file ... more important stuff for work and now it's gone! Help!!!" But if you're in the Terminal app, then you can easily create files or directories with . as their first letter: mkdir .foo should work. You won't see it when you do ls, but ls -a (a for "all") will show you all files, including hidden files. And you can also do cd .foo and create files inside the hidden .foo directory -- and while the .foo folder won't show up in Finder, it will be perfectly accessible in the Terminal, and to any F# programs you might write.
So when you say that you cloned https://github.com/fsprojects/Paket but it failed to include the .github and .paket directories, I think you just don't know how to see them. You can't see them in the Finder (well, you can if you jump through a couple of hoops but I don't think it's worth the effort), but you can see them with ls -a. Just open your terminal, run cd /Users/Username/Paket, and then run ls -a and I think you'll see that the .paket and .github directories were indeed created by your git clone command.
So what you should probably try is this:
Go to https://github.com/fsprojects/Paket/releases/latest
Download the paket.bootstrapper.exe and paket.exe files. Put them in /Users/Username/Downloads (or wherever the default OS X Downloads directory is if it's different -- just as long as it's somewhere where you can find them easily).
Open the Terminal app.
Go to the directory where you've unpacked the Sublime Text 3 package. I.e., in the Terminal app, run cd /Users/Username/Library/Application\ Support/Sublime\ Text\ 3/Packages/sublime-fsharp-package-master.
Run ls -a and see if there's a .paket directory.
If it does not exist, run mkdir .paket.
Now do cd .paket so you're in the hidden .paket directory under sublime-fsharp-package-master.
Now do ls and see if there's a paket.bootstrapper.exe file.
If it doesn't exist, then copy in the .exe files you downloaded earlier:
cp /Users/Username/Downloads/paket.bootstrapper.exe .
cp /Users/Username/Downloads/paket.exe .
Important: Now do cd .. to go back up to the /Users/Username/Library/Application\ Support/Sublime\ Text\ 3/Packages/sublime-fsharp-package-master/ directory.
Now instead of running /Users/Username/Library/Application\ Support/Sublime\ Text\ 3/Packages/sublime-fsharp-package-master/build.sh install, try running it as ./build.sh install. (And also try ./build.sh Install, since I'm pretty sure the capital I is necessary).
(BTW, If you're not familiar with the syntax that I used in steps 9, 10 and 11, where I used a single . or two dots .. in commands, those are a long-standing Unix idiom: . means "the current directory", and .. means "the parent directory".)
I just looked at the build.sh script that you've been running, and it seems to assume that you've done a cd into the package's base directory (the sublime-fsharp-package-master directory) before running the script. So that could explain why it was failing: you were running it from a different directory, rather than doing a cd first. Hence why I marked step 10 as important: I think that was the root cause of the problem.

How to install ninja-build for C++

https://github.com/ninja-build/ninja/releases
I have downloaded the ninja-win.zip folder and extracted it. When I open it, there is a single .exe file in the entire folder. When I double click it a cmd window flashes for a split second. I have also tried running it as administrator, but the same thing happens. What I don't understand is, what am I expected to do with this .exe file?
You must open a terminal (cmd.exe on Windows) and type something like ninja -f /path/to/buld/file. You may also wish to modify the PATH environment variable so that Windows knows where to find the Ninja executable, depending on your setup.
You can simple download ninja.exe file from this Link
https://github.com/ninja-build/ninja/releases
After that you just have to add the path to your ninja.exe file to your windows environment variables and then you can use ninja commands from anywhere in windows.
1. Open cmd in your Project Directory
2. There are guides on the internet on where to save the Ninja.exe so that it'll be callable in Cmd without specifying directory. Either follow them or:
i, Specify Directory when Calling Ninja. Putting "ninja" in Cmd actually calls Ninja.exe and is the same as something like "C:\users\user1\downloads\Ninja". or:
ii, Save Ninja.exe in the same directory as Project.
3. proceed with rest of the command.
Therefore the Final Command would be:
"C:\users\user\downloads\Ninja.exe" -f "D:\Projects\Project1"

Sublime Text 3: how to create a build system?

I m a ROS user. With that framework you usually define a working directory:
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
// Here create your c++ packages
and then let the system to compile your packages by typing the following:
$ cd ~/catkin_ws/
$ catkin_make
But this means that you should keep at least one more console open, to call the command:
$ catkin_make
which compiles at once all the packages you ve written in that working directory.
Since I m using Sublime Text 3 to write my software I want to be able to call that function from Sublime
I went through this tutorial so many times, but I still don't understand how I can create my building system.
I tried already with the following:
{
"path": "~/workspace_ros",
"cmd": ["catkin_make"]
}
but I get the following error message:
[Errno 2] No such file or directory: 'catkin_make'
[cmd: ['catkin_make']]
[dir: /home/will/workspace_ros/src/flight_system/src/include]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
[Finished]
I tried even with the following options:
path
shell_cmd
but still it doesn't recognize catkin as command for compiling
What's wrong?
PS: in the workspace I have already a CMakeLists.txt file. Calling catkin in the shell compiles everything fine.
I am not sure if this is the best way to accomplish it, but this is what I did. Keep in mind that I did this for a winros project, so for regular ROS projects, you just need to tweak it a bit.
First, I created a build system for the project as follows (so append this to your project file):
"build_systems":
[
{
"name" : "ROS",
"cmd" : ["$project_path/build.bat"],
"working_dir" : "$project_path",
"variants" : [
{
"name" : "Run",
"cmd" : ["$project_path/run.bat"]
}
]
}
]
I then created the build.bat and run.bat scripts referenced in there in the project's root directory (in your case ~/workspace_ros). I created these scripts because there is more to building/running the nodes than just calling catkin_make. You also need to call the setup scripts first.
Here's build.bat
#ECHO OFF
REM Basically, change the cwd to the project's root dir
SET ws_path=%~dp0
cd /D "%ws_path%"
call setup.bat
winros_make -i
You might want to change this to a bash script for your linux system, and tweak the script itself. The idea is to change your cwd to the project's path and call the setup file and build afterwards.
Here's run.bat
#ECHO OFF
REM Call the setup script and launch the node
call "C:\opt\ros\hydro\x86\setup.bat"
roslaunch eyetracker_talker talker.launch
Again, you might need to change this to a bash script. In my case, I use roslaunch to run the node.
Finally, this gives you two build options (Build and Build: Run). The output of both should be shown in the build output window.
Hope this helps.
I realize this is a bit of an old question, but it is still top on google for using catkin with Sublime, so heres my shameless self plug.
I recently wrote a Sublime 3 Package, Catkin Builder that bulids ROS packages inside Sublime. It uses catkin build as opposed to catkin_make but it might help you out.

Building PostgreSQL driver for Qt

I trying to build psql driver but have some unexpected messages.
maxim#maxim-VirtualBox:~/Downloads/distrib/qt-everywhere-opensource-src-5.2.1/qtbase/src/plugins/sqldrivers/psql$ qmake psql.pro
Cannot read
/home/maxim/Downloads/qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/modules-inst/qt_lib_bootstrap_private.pri:
No such file or directory
...
Cannot read
/home/maxim/Downloads/qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/modules-inst/qt_lib_xml_private.pri:
No such file or directory
But all of these files exist. What is the problem?
The problem seems to be that you have "modules-inst" as the subfolder name, whereas it is only "modules" without the "-inst" suffix in reality.
See how it works fine on my end:
lpapp ~/Downloads/qt-everywhere-opensource-src-5.2.1/qtbase/src/plugins/sqldrivers/psql $ qmake psql.pro
lpapp ~/Downloads/qt-everywhere-opensource-src-5.2.1/qtbase/src/plugins/sqldrivers/psql $
I found a problem. After install qt-libraries I created new folder 'distrib' and move sources in there. That's why I got this problem.
I should have checked the existence of the directory by cd command.