latest clang-format on centos - llvm

I would like to use clang-format in my project, however, the version that comes with centos 7 seems to be very old. Where can I download the latest version ? I looked at llvm/clang svn repo (and also git repo - https://github.com/llvm-mirror/clang/tree/master/tools/clang-format) , but I don't understand if it is something that I need to compile myself or if it is just a script that I can download and use.
Can someone please help how to get going on this ? I do have a .clang-format file ready, but the older version is not recognizing many keywords in the file.
Thanks,
S.K

I was able to figure this out by following the instructions at http://clang.llvm.org/get_started.html. I had to include to clang extra tools, which are put under "optional" category in that link. Once I compiled the whole tree, bin/ directory had the clang-format executable.

Related

How do I set path to respective bin of the mingw directory

I'm trying to use C++ in VSCode, and I found a tutorial where I install g++ and clang to make it work.
I installed g++ fine, and added it to my list of environment variables, but then the instructions for installing clang say to "set path to respective bin of the mingw directory" without showing me how.
What does this mean and how do I do that?
Also, #include <iostream> looks like it doesn't work either, it says the file is not found, so I'm wondering if it's because clang isn't installed or something else I need to fix. Thanks!
Ok, I've skimmed that tutorial video and YouTube comment section. Basically I think it's a poor tutorial, as it doesn't explain the basics, and that's why you're getting tripped up. My first recommendation is to save yourself some trouble and follow the VSCode Getting Started with C++ Tutorial instead.
Not only is the official tutorial easier to understand, it will guide you toward using the Microsoft C++ extension that almost everyone uses (and can help you with), rather than the comparatively obscure Clang-based C++ extension.
But that's not answer to your actual question. You asked:
... the instructions for installing clang say to "set path to respective bin of the mingw directory" without showing me how.
What does this mean and how do I do that?
I'm not sure! It's sort of nonsensical. But I think what is meant is:
Install mingw GCC and put its bin directory on the PATH.
Install LLVM+Clang and put its bin directory on the PATH.
Start VSCode from a shell where both are on the PATH.
Then proceed with the linked tutorial.
You say you already have mingw GCC on your path, but let's check that. At the command prompt (I assume you are using the default Windows cmd.exe shell), run:
> gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you don't see output like that, then something is wrong. Make sure the bin directory of mingw GCC, which contains gcc.exe, is on your PATH.
Next, Clang. Clang is part of LLVM. Wherever you installed LLVM, there should be a bin directory inside it containing clang.exe. Add that to your PATH. In my case, I installed LLVM into d:\opt\llvm-8.0.1, so I would run:
> set PATH=%PATH%;d:\opt\llvm-8.0.1\bin
Then check that it is working:
> clang --version
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: D:\opt\llvm-8.0.1\bin
Once both gcc --version and clang --version respond similarly to what I have shown, you're ready to start VSCode:
> code
and from there, the tutorial's instructions should work.
I faced a similar issue a while back. Go to the installation directory of mingw/bin. copy this path and add it to the environment variable PATH to your Windows system, save it. Relaunch vscode and then try pressing ctrl + ` and execute code using g++. This way gdb will also work.

Cannot open include file 'getopt.h'

Firstly, I know nothing about C/C++, but I am trying to compile LCI https://github.com/justinmeza/lci under Windows 10 with Visual Studio 2015, but I'm getting the following error:
Cannot open include file: 'getopt.h': No such file or directory.
I see that getopt is not part of Visual C so people are saying you have to implement your own. It looks like this is what I need:
https://github.com/skandhurkat/Getopt-for-Visual-Studio/blob/master/getopt.h
Problem is, I don't really know what to do with this file. I've been reading a fair bit and messing around for ages just to compile lci.exe!
Already emailed the OP about this, but here's the steps I followed in order to build lci successfully. The missing step seemed to be that Justin Meza neglected to mention that you need to install CMake as well in order for the install script to work. CMake will allow you to build C code against the glibc headers.
Install MinGW
Install Python 3.5.1 (or latest Windows version)
Install Git for Windows (if you haven't already)
Make sure to enable Git for the Windows command prompt
Install CMake
Add MinGW and Python to your PATH environment variable. I'd double check that your paths to the executables are correct, mine looked like this:
C:\Program Files\mingw-w64\mingw64\bin
C:\Users{username}\AppData\Local\Programs\Python\Python35-32
Run a command prompt as administrator, and go to your Documents folder and clone the lci repository (if you haven't already):
git clone https://github.com/justinmeza/lci.git
Go into the lci directory, and run:
install.py --prefix="C:/Program Files/lci"
Add lci to you PATH, if using the default location add this to the end of your PATH:
C:\Program Files\lci\bin
I would have included some links to the various programs above in steps 1-4 but apparently I don't have enough reputation on StackOverflow for that...you should be able to find them easily enough in a quick Google search.
You should now be able to run lci from any command prompt. A good test would be to run the "HAI WORLD" code at lolcode.org.
Just copy getopt.h to the directory where .c files are, so the compiler can find it.
Based on the linked source code and it's contents, the project you're trying to build appears to be written for Linux. It might be possible to sufficiently rewrite it to be able to compile under Microsoft Windows, and Microsoft's compiler; or perhaps install something like MinGW.
However, given your stated lack of development experience, this does not appear to be something that you could easily handle on your own.

How to install Qt 3.3.8 in Ubuntu 14.04

Just recently I have begun to review the code for a project produced by a friend roughly 4 years ago. However, to compile this project I need an outdated version of Qt (version 3.3.8). Much of the code used in this project isn't supported in the same style as Qt4. So I'd first like to obtain Qt3 before I transition to Qt4.
Ubuntu has decided to no longer carry "qt3-dev-tools". Ubuntu has limited the selection to "qt4-dev-tools" in its repository. So installing via the command line option (sudo apt-get install qt3-dev-tools) results in an error:
"Unable to locate package qt3-dev-tools."
So, from here I did some digging for a manual installation? I found a great website to help me through the process, but I'm not very knowledgeable about Ubuntu, or Linux in general. Step 1 was simple. But step 2 and onward stumped me. I'm supposed to be both adding the environment variables listed in step two to the .profile file and then setting them, correct?
In step 2, is logging in again just meant for users with the .login shell? When I type in $HOME/.qt-license of step three, I suppose I'm typing this into the terminal?. Same with the ./configure? Both of these commands return no such file exists.
Does anyone know a better walk through to install Qt3 files, or can give a quick breakdown of this tutorial?
The website tutorial:
http://krm.am.gdynia.pl/doc/qt-3.3.8/INSTALL
If u can get .rpm package then open it in ubuntu software centre . It will get installed.
http://download.qt.io/archive/qt/3/ try downloading the package for qt3 from this qt archive & install it.

dicom3tools compiles with missing application pbmtoovl

I've downloaded dicom3tools in Ubuntu apt-get install dicom3tools, but certain apps are not present.
I've downloaded the source and compiled according to directions on Ubuntu without errors. I have access to most of the apps in the kit, but some just seem to be missing or not compiling.
I need a working binary copy of the pbmtoovl tool from this kit.
Can anyone help me?
Do you know why it is missing?
Do I need to compile differently?
Do you have a copy of the pbmtoovl app pre-compiled?
There is no info on this anywhere on the web, I have nowhere else to turn.
Thanks in advance for any info on this.
Please please help me with this.....
I edited the proper file with a uid.
I ran
imake -I./config -DInstallInTopDir -DUsemyID
and everything looked fine.
make World.
make install
make install.man,
but still no rawtodc or pbmtoovl or any of the dicom creation tools. I really need these tools. Please let me know what I'm doing wrong. On Ubuntu 14 –
I am the author of the dicom3tools debian package. The explanation is given online here.
When you install a debian package, you are required to read the documentation. In this case the documentation was available on your system from:
$ cat /usr/share/doc/dicom3tools/README.Debian
So you'll need to follow the build instructions yourself (see INSTALL):
Edit config/site.p-def to set your UID root (a la UseClunieID, to be
selected with a UseXXXXID define on the imake command line).
NB. Don't ever use any UseClunie*ID or your instances
will conflict with mine !
./Configure
setenv IMAKEINCLUDE -I./config # only needed for suns
imake -I./config -DInstallInTopDir -DUseXXXXID
make World
make install # into ./bin
make install.man # into ./man
I finally did a fresh Ubuntu install, installed xutils, g++, gcc and ran the compiling instructions. It did not install, again, but this time I did have a new directory in bin ending in 'unknown' that miraculously contained all of the compiled binaries. I added that dir to the PATH and VOILA I can access all the tools from the command line....
It's still a problem, but I can now use pbmtoovl

Can't get premake working - gltut demos

https://bitbucket.org/alfonse/gltut/downloads
this is the repository for the several tutorials in this online-book
http://www.arcsynthesis.org/gltut
the author uses premake as alternative to cmake, and i have tried every possible command line options but nothing works.
I don't get why the author wants to use the latest tool on earth but i need to solve this and i don't even have a clue about Lua and this tool.
For who wants to help me with this you have to download this to actually build the demos and put it in the root folder of your gltut project.
The URL for the mercurial repository is
hg clone https://bitbucket.org/alfonse/gltut
My OS is Ubuntu 12.04 64 bit.
I just noticed that the premake version that comes with Ubuntu 12.04 is the 3.7, just download a newer version from the 4.x branch and the problem is solved.