use c++11 on mac os x mountain lion with eclipse (Juno or Kepler) - eclipse

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.

Related

debugging rust on Eclipse Corrosion no longer works on fresh install

I change my Hard drive and so I made a fresh Eclipse Corrosion install but I kept my Rust projets. Problem is I get an error when I launch my prog in debug mode. It seems to work in run mode but I didn't test this that much.
Error is
An internal error occurred during: "Launching my_prog".
Cannot read the array length because "launchConfigEnv" is null
Important note : it seems to be link with the use of an input file (debug configuration/common/input file)
I try many things, many installs, new projects, many, many things but nothing works (and I cannot figure out what launchConfigEnv is).
Any help welcome...
Edit : I install 2019.12 Eclipse and it works fine. I will work a little with this version and try out more configuration to shrink the problem.
As a workaround, add a single environment variable to the launch configuration, as follows:
Once that is done, re-launch it and it should work.
Note that in order to get rust debugging working in Eclipse I installed MSYS2 and the following MSYS2 packages.
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S man
I followed some instructions in the Rust Corrosion Trouble Shooting guide to get a working GDB.
Reference: https://github.com/eclipse/corrosion/blob/master/documentation/Troubleshooting.md#debugging-on-windows
The Rust debugger command needs to be changed to rust-dbg.cmd, as follows:
However, the PATH environment wasn't working for me, so in the rust-gdb.cmd script I added this near the top:
SET PATH=%PATH%;F:\msys64\mingw64\bin;F:\Data\.cargo\bin
(Adjust as-per your installation of MSYS2 and Cargo/Rustup)
After which Eclipse was able to start a debug session and stop at a breakpoint.

Clion gdb not found, but working with netbeans

I've seen some other stakoverflow question like this one:
CLion Installation: Cmake compilers not found, GDB not found
But it's not quite the same problem.
My problem is that only my gdb.exe is not found by Clion. I can compile and run programs without problem, but when i need to debug the program tell me that only the debbuger is incorrect.
The problem is that my gbd.exe is present in my cygwin/bin folder
and i have it also in my PATH (system variable)
What i've done so far:
delete, shutdown and reinstall cygwin from scratch.
Install Netbeans and try to run with cygwin config (and debugger) -> everthing is working and i can debug my program. I also try to select it manualy.
So the real question is why Clion think my gdb is not present?
An how can i make it work?
Thank you for your help
Try to install GDB version 7.10.1
My settings:
Short answer: check what versions of gcc, g++ and gdb you have installed. They should be of the same major version.
Long answer:
Try to launch gdb.exe from cygwin terminal. You will probably get something like this (I'm using mingw64 from msys2 so folder will be different):
$ gdb
C:/msys64/mingw64/bin/gdb.exe: error while loading shared libraries: libgcc_s_seh-1.dll:
cannot open shared object file: No such file or directory
But you have gcc installed so you will have this DLL inside C:/msys64/mingw64/bin (in your case folder is different). The problem is that your gdb and gcc are of different major versions. I got this problem when installed mingw-w64-x86_64-gcc-7.3.0-2 with mingw-w64-x86_64-gdb-8.2.1-1. That's why gdb was not able to launch and CLion was not able to check GDB version thus outputting "Not found" error.
If this is the case - remove gdb and install it again. Now with correct major version (same as gcc). Since you're using cygwin, launch cygwin setup again, search for gdb package (don't forget to change view to full) and change version to be the same as gcc. Or, alternatively, you can change gcc version to be the same as gdb (in my case this wasn't possible).

How do I use Eclipse for Scheme development?

Has anyone succeeded in running and debugging Scheme with Eclipse?
I've tied several plug-ins (scheme 48, schemeway) and couldn't get them working. I'm not sure why they won't work; I downloaded an interpreter (kawa, mit-scheme) and tried to configure it in the plugin but nothing happened (except that mit-scheme threw some errors).
I know there is another way - Racket, but I prefer not to use another IDE. I work with many languages and I'd like to be able to use one IDE for all of them.
Any suggestions?
EDIT:
I tried to run the simplest .scm file (that has only (+ 1 1) in it). By configuration of the plug-ins I mean that I choose an external interpreter and then choose the kawa/mit-scheme interpreter exe file. When I choose kawa with schemeway it open a new window and waited for my input (I didn't have any input - JUST wanted to run the file...). When I did it with mit-scheme interpreter I got this error...
I am using linux-centOS 6.
Found the solution - here it is if someone else will encounter the same error:
There are 2 step when trying to work with Scheme 48 in Eclipse:
install the plugin - just follow http://s48.org/sdt/
install the interpreter - I finally found 2 that I can work with :
Scheme 48 (I use ubuntu so I typed scheme48 in the command line and it gave me the package that I need to install (I think it was
sudo apt-get install scheme48)). Then open the preferences in
Eclipse and go to scheme48->interpreter and check that the
command line is scheme48.
guile - I think that it is supported by gnu. It also the one I prefer. It had less errors and more understandable error output in the consul. Again, to install it I just typed guile in the command line and it gave me 3 versions. I installed 1.8. after installation I created a scheme project and a simple file. go to the preferences and changed the command line to "guile" and the working directory to the path of the project I just created. to load the file just search for the load file into interpreter button (or press Ctrl+F6).

Step by step instructions for getting cppunit up and running with Netbeans 7.2 on OS X 10.8 Mountain Lion

Can someone please provide step by step instructions for getting cppunit working on OS X 10.8 Mountain Lion? This includes any downloads needed and any configuration of Netbeans.
Currently, when I add a cppunit test, there is a warning on the Add Test dialog that says "cppunit library is not detected. Test compilation might fail." I've download both from Sourceforge and from svn cppunit and copied the files to /usr/local/include, but this does not make compilation errors go away.
What am I missing? The Google™ has been of no help with this issue.
I used Homebrew to install CppUnit on OS X 10.8 Mountain Lion. Unit tests then worked from within Netbeans without issue.
The process I followed was:
Install the XCode Command Line Tools
Available in XCode preferences or Download as separate DMG
Install Homebrew
See Link
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
Following install instructions (brew doctor at the end for example)
Use brew to install cppunit
brew install cppunit
In Netbeans:
Create C++ project
Add a function to test
Right click cpp file, select "Create Test", choose CppUnit Test
Select function from list, follow prompts to create test
Execute tests
Right click project, select Test (or crtl+F6)
I finally figured out what I was doing wrong, so I thought I would answer my own question and avoid a Wisdom of the Ancients.
install Xcode.
install Xcode Command Line Tools via the Preferences dialog (Apple's documentation showing how to do this in Xcode 4)
download CPPUnit from Sourceforge
extract
Run ./configure
run make
run sudo make install
It's possible that the first time I tried this I didn't run the correct command for ./configurebut that's a dubious claim given the fact that I was able to tab complete i.e. I shouldn't have been able to run say ./config.
But I think the real key to my problem was having to call sudo on the make install. I was getting a permission error because the script needs admin rights to put the libraries where they need to go. I could have swore I tried this at some point and it too failed.
I had a coworker try this for me a month or so ago and he got it to work. I procrastinated retrying, but once I did, it worked like a charm. As far as I know, there's no bug between OS X 10.8.1 and 10.8.2 or .3.
Once I followed the steps I have listed above, I was able to go back to Netbeans and add a unit test without the dialog complaining. Furthermore, the test code compiled and ran.

How can I make Pygame work with Pydev?

I'm working off the latest Mac OS trying to set up my programming environment. Right now what I want to do is to get Pygame working with Pydev so I can do my Python programming from Eclipse. What I've done so far is installed Python 2.6 from python.org and then installed pygame 1.9 from the site.
What happens is that when I try running Python from the command line, I am able to import pygame without a hitch, but when I try to do the same thing from Eclipse, it doesn't work.
I think it might be because Pydev doesn't know where to find Python, in which case I would like some help on how to make sure it's pointing to the right one.
Thanks!
I work with Eclipse on Windows, but I believe that the Mac version eclipse should be the same.
In Eclipse,
click Windows > Preferences,
expand PyDev from left side,
find Interpreter - Python,
switch to Libraries tab,
click New Folder on the right hand,
navigate to your pygame path, and
click Apply and OK.
Turn to your Python project in eclipse,
right click on it,
choose PyDev - Interpreter/Grammar,
choose Python as Project type,
choose 3.0 or your correspond Python version from Grammar,
at last make sure the Interpreter you are using is the same as the one you just configured.
Build your project from eclipse, and it should work.
In Eclipse, Window->Preferences, expand Pydev and choose Interpreter - Python. Then specify your python path. Try first by clicking "Auto Config" to auto-locate your python installation. Then click Apply and Ok.
Make sure this much works by creating a new Python project (without worrying about Pygame yet).
I tested these instructions from Eclipse Helios on Windows. Hope it works for you.
http://www.vogella.de/articles/Python/article.html
If autoconfig is not finding 2.6 you can add it manually at Preferences/PyDev/Interpreter - Python. There you have to press New and set the path for your Python executable.
For Python2.6 the path is: /System/Library/Frameworks/Python.framework/Versions/2.6/bin/Python2.6
For Python2.7 (and higher), the path is different:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Those paths work on OS X 10.6.8, might change for other versions.
Do what the people says, and if that does not work, make sure that you have downloaded the development package.
On menu Window > Preferences > PyDev > Interpreters > Python Interpreters
If your python interpreter config have a pygame and don't work, try to put on force bultins the new keyword "pygame"
Python part
Install Python 3.5.2 32 bits (From python.org)
Download the right pyGame library for 3.5.x 32 bits (It will be pygame-1.9.2b1-cp35-cp35m-win32.whl)
Open the system console and go to the folder where the library was download.
Write in the console: pip install pygame-1.9.2b1-cp35-cp35m-win32.whl
This should install the pygame library.
Note: If the pip version is not the last one, upgrade it. (In this step you should know how, just pay attention.)
Eclipse Part
Open Eclipse
Go to Help>Install new software.
Look for the botton "Add" in the right top corner.
In Location put http://pydev.org/updates. Put a cute name, too. Then click OK.
Check pyDev checkbox. Go next, Finish. Accept licenses. In simple words: Install it.
Go to Window>Preferences>pyDev>Interpreters>Phyton interpreter.
In the Python interpreters part, click Quick Auto-Config.
Note: If you want to do this manually, you should know the path where you installed Python and search for python.exe
Some libraries should manifest in the libraries tab. Click apply.
In the libraries tab, click New Folder.
Search for PyGame installation path (In my case, C:\Python\Python35-32\include\pygame but it's always on Python installation path plus include\pygame, ok?)
Click Accept.
Go to Forced Builtins tab. Click New... and add 'pygame'.
Apply again ! (You should know that I do this only for safety. You can apply just one time.
Click OK.
Test
File> New> Proyect...> PyDev> PyDev Proyect.
Click Next
Complete the Proyect Name. On Grammar Version combobox, select 3.0 - 3.5 and in interpreter choose python.
Note: "Quick Auto-Config" named "python" to the interpreter. If you did this part manually, you should know the exact name because you named it.
Try simple code
import pygame
print(pygame.ver) # This should print the pygame version.
pygame.init() # This does nothing by now, just checking code.
I wasted forever trying to get this to work as well..
I eventually found these steps (you don't need them all just part of my struggles shared).
in Python Shell:
import sys
print (sys.path)
Noticed NO PYGAME in path.
Eventually I GAVE UP on the .exe binaries and was told to use .WHL files and Python PIP to install. but was told NOT VALID wheel file. (frustrating).
what EVENTUALLY WORKED was to (in windows, but similar should work in other OS's).
run Command Prompt as Administrator (just to be sure) Maybe same in other OS's. you'd have to try.
from C:> i Changed Dir to my Python.exe (or the python program itself).
from my python directory in command prompt I typed the following (Like I would a Linux apt-get install command):
**
python.exe -m pip install pygame
**
Shortly after, there were hash marks ##### indicating a download was taking place (Linux type progress bar in shell).
in ECLIPSE without ever changing the Libraries folder to include PyGame folders I was able to run a sample Python PYGAME Script sample (I got a white screen but haven't gone further yet). I was just HAPPY to not have to see the trace back error message :)
now I am finished typing this to you I will be going to test it out further.
Just thought this would help someone :0)
I met such problem in Python 3.6 using LiClipse (which should be similar as Eclipse). It's solved by import pygame as
import pygame
from pygame.locals import *
Then add the pygame folder to Window>Preferences>PyDev>Interpreters>PyDev>Libraries, type in 'pygame' in the Forced BuiltIns tab at the same page, also right click the project, change Properties>PyDev-PYTHONPATH>Source from {proj_dir_name}/ to {proj_dir_name}/src
Maybe some above steps are not necessary. Anyway doing all aboves solves the problem in my case.