I am new with Linux. I want to compile my code which written in qt creator using gcc in terminal. I don't know how should I do this task. the output will be called in Matlab. please give me information in this area. I search through the internet but i didn't find useful information to solve my problem.
Thanks
In QT Creator select "New project" -> Non-QT project -> plain C or C++ application, you can then edit your source in QT Creator, go to a Terminal & compile it using gcc or make your own makefile. From the Matlab instructions "The exclamation point character (!) sometimes called bang, is a shell escape. The character indicates that the rest of the input line is a command to the operating system. Use it to invoke utilities or call other executable programs without quitting MATLABĀ®".
Related
I started learning OCaml several days ago. I installed everything and tested a small program on Atom which worked ok.
But I don't really understand how to work on VSC. I created a file 'test.ml',but how can I run it ?
Thanks in advance
Assuming VSC is Visual Studio Code (and you're on a Unix-like system):
If you want editing support such as auto-completions, you need to install OCaml Platform extension for VS Code by following installation steps outlined here. Note that the instructions indicate that you need to also have ocaml-lsp-server installed.
If you need to run test.ml as a program, you should do in the VS Code terminal:
$ ocamlc -o test test.ml # compile 'test.ml' into an executable 'test'
$ ./test # to run the program
Note that VS Code doesn't have a ready button to run an OCaml file as an executable (not yet at least).
Newcomers to OCaml are recommended to explore language either with ocaml or utop REPL.
How to get utop: Assuming you have opam installed, you should opam install utop. Aforementioned opam is a package manager for OCaml, that can also help you manage OCaml versions and is indispensable if you want to get serious about OCaml development.
Then you'll be able to launch utop in terminal, and inside utop, you can execute test.ml with
#use "test.ml"
assuming that utop was launched from the folder containing test.ml.
You should be able to do the same with ocaml REPL that is installed along with OCaml compiler, but it's much less convenient.
hey everyone I am just starting to use c++11, which I need for uni, a have a mac and I am familiarise with eclipse (I have both Juno or Kepler with CDT), but as much as I tried I can not run properly any c++11 features in eclipse or compile any code, there is someone that has been in my same position and please help me, seriously I already try all the previous threads about, but for my frustration i am still compiling everything on terminal and editing all in gedit with is not the most confortable way, by the way I have to compile with g++-4.7 as command not g++ meaning that still I have the old OS gnu,please someone just explain me step by step what to do I am terribly frustrated, I beg!!!!
ps. just clarify i install gcc 4.7 with homebrew but the path is different than the original (/usr/local/bin instead of the regular /usr/bin which I believe eclipse use and the reason I can't work with it, thank you for all guys)
Well after trying different things and expending tedious time fixing my issue I will answer my own question with the hope someone with my same needs will not experiment such annoying situation.
First as in a lot of forums remark and is well know the gcc compiler provided for the Mac OS is old and obsolete (more than 5 years old is a lot in computing terms), so first step to work with c++11 is to get a new version of the gcc.
There are two options with the packets common managers (homebrew and macports), I have to say that I was that frustrated that i tried both to see if was a problem of the version in the packet manager even thought should be the same, but for my surprise there is a small difference which later I will explain, which bring me to suggest use macport because with macports the eclipse will work as smooth as with the old c++ while with the installation with homebrew the compilation will be the same than the macport but eclipse will complain about the new grammar in the c++11 (eclipse will tell you that the resource couldn't be resolve, even do compile properly ).
The steps for this are assuming you have the command line already:
download the appropriate macports from the official web page(google it)
in terminal type the following commands
sudo port selfupdate
sudo port upgrade outdated
sudo port install -d gcc47
port select --list gcc
with this you have gcc and will show you which are the gcc installed in you mac now just missing select as defauld the new gcc, do it with.
- sudo port select gcc mp-gcc47
3 having install in my case eclipse kepler create a new C++ project, but instead to left everything standar do the next:
- in the wizard window select as toolchain the cross GCC as the toolchain(for example ni the executable Hello World c++ project), put a random name and next , following window press next now here in the window for the selection of the compiler give the path for the new gcc(the default is /opt/local/bin) as prefix leave it empty and press now the finish bottom.
4 Now go to project properties and in c/c++ build select settings and in the tool settings tab go to miscellaneous in cross g++ compiler and in other flags add -std=c++11.
5 by the last go to c/c++ general -> paths and symbols and select the tab symbols and in select the gnu c++ language and press add to type GXX_EXPERIMENTAL_CXX0X as name just that and press ok.
Now just press apply and ok, after that your mac should be running c++11 in eclipse.
Hope works for you as for me see you around guys.
Note probably you will be to configurate the run but it is more simpler than you thing just go to run -> run configurations and double click in c/c++ application now almost everything is generate for you just you have to fill up the first label with the path to the out put of the compiler (I asumme that you already build the project which will generate the executable file ) normally that file is in the debug folder of the project with the same name than the file compiled n does all.
have a good one guys.
I am using the plugin "plugin builder" to generate a template. The plugin builder is also generating a make file. I am working on a computer using windows 7 and am trying to execute the make file using the command line of Windows (MS Dos). However, this doesen't work. This means that my *.ui and my *.qrc file are not compiled to python, if I understand correctly.
What can I do? I am not very familiar with pc or programming so I hope to finde someone who can give me an easy understandable answer. Thank you.
Run the code in the osgeo4w Shell
And follow the steps in here:
http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html
If the osgeo4w shell doesn't work copy the qtcore4.dll and qtgui4.dll to the windows system directory first
Regards
'make', works in linux by default as it is part of its build system. For windows, you could try downloading GNU Make Setup from below link
GNU make link
afterwards, you should be able to run 'make' from your dos prompt
Platform: Windows 7 64 bit
Hi all,
I want to compile with gcc. So I have added the path to the gcc binary to the PATH environment variables. Whenever I type gcc in the command prompt, I wish to see something like "no input file specified" (from gcc itself). But instead I get the message "perl is not recognzied".
To cut short, when I type gcc in the command prompt it refers to perl for some reason. I have check all environment variables, and there is nothing that points to perl...
I have rebooted for several times already, without success.
It is not much of a problem to use the full path to gcc when I want to compile just a single file. But when I use make it does not work. Because make uses the gcc command again. Which then refers to "perl".
Any suggestions?
Thanks in advance.
How odd.
Try:
set CC=x:\path\to\gcc
make ...
(See http://www.gnu.org/s/hello/manual/make/Implicit-Variables.html.)
Don't use make on Windows. Use dmake -- available at: http://search.cpan.org/dist/dmake/
make on MinGW(32|64) is somewhat broken at the best of times. Windows Perl's are usually built with dmake (or nmake if you are using Visual C++).
I would like to use Emacs as a development environment for Arduino programming. What are some tips or links to use Emacs to program Arduino?
Is there an official (or de facto) Emacs mode?
Also, am I going to miss something in Arduino IDE if I use Emacs exclusively?
There's a nice Arduino mode on GitHub.
Just wraps cc-mode, but it does a nice job.
Update:
The EmacsWiki has a page dedicated to Ardunio Support for Emacs. The setup has a few steps but once done it allows you to compile and upload sketches from inside Emacs.
You can enable an external editor option that will allow you to edit projects using external editors and then use the Arduino IDE as some kind of terminal just for compiling and uploading.
I just edit stuff in Emacs, then switch to the IDE to just hit compile and upload. No need for makefiles.
Arduino code is just C++ wearing a dress and hat. You should be able to use that mode in Emacs without problems. You may miss the one-click-compile-and-transfer button, as well as the organization of the libraries from the official IDE. You can replicate either in Emacs of course. There is nothing the official IDE does that Emacs can't do.
There is support in the Emacs tool CEDET for programming with Arduino. As I write this, the support is available in CEDET 1.1 or later from cedet.sf.net.
It has all the development features as described for CEDET, plus Arduino only features, like uploading your program to the Arduino. See more here:
http://www.randomsample.de/cedetdocs/cedet/Arduino-Features.html
I use this Makefile and I find it very useful.
http://ed.am/dev/make/arduino-mk
As previously mentioned you do not need any external mode.
Since I am a newbie interested about learning Arduino I write small programs. Instead of creating several sub directories, one per snippet, and putting the makefile in each I decided to do it on one directory.
So that I'd be able to built the last edited source file (*.cc) . Here is my current Makefile.
SOURCES := $(shell ls -tp *.cc | grep -v /$ | head -1)
BOARD := uno
LIBRARIES := Stepper
include ~/arduino/arduino.mk
The commands that the Arduino IDE uses in the background change often, so the above info is probably out of date. I'm using IDE version 1.6.4 at the moment.
To find out the current commands, in the Arduino IDE | File | Preferences, check "Show verbose output during: x compilation x upload". Then you can see the full command in the IDE log window, and adapt your Emacs Makefile to use them.
For IDE 1.6.4, targeting a LilyPad Arduino board, that shows avr-gcc for the compiler, and avrdude for the uploader.
Choose C++ Mode in Emacs, then run the files in the Arduino IDE. Choose avr-gcc as the compiler, and avrdude as the uploader, if you want to compile in Emacs. Merry making!