Change a default path in the Atom editor - c++

I am using the Atom text editor to write c/c++ codes. By default I need to save all my programs in the C:>.atom> packages> MinGW> bin folder.
Now, I want to change the location where my programs are stored to a new folder which is comfortably placed in say, C:> My Programs. This works fine in CodeBlocks and before creating any console application there, I can choose the location manually and therefore all my programs are neatly arranged in the folder C:> My Programs that I have created. But, when I try to place a program anywhere other than the C:>.atom> packages> MinGW> bin folder or simply try to open a previously created program (with CodeBlocks) from the C:> My Programs folder, this error pops up in Atom -
'g++' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning process.
I don't know what to do.. How can I 'tell' the gcc compiler that look into this file rather than the default?
Can anyone please guide me through the steps?
Thank you so much.

Related

How to run c++ program written in eclipse, from terminal

I'm using Ubuntu and I have written my c++ code in Eclipse Neon.
My workspace contain 4 projects. The main project is called BaseCppProjectRun (it contains main.cpp file) and I have other projects with these names: Encoders, frmwrk, NetworkLayer - the BaseCppProjectRun using each one of them.
If I running my program directly from eclipse everything works.
But I want to running my program from terminal - and I can't.
Because When I'm trying to run my progrm like this:
root#ubuntu:/builds/BaseCppProject/BaseCppProjectRun# ./Debug/BaseCppProjectRun
I'm getting this error:
./Debug/BaseCppProjectRun: error while loading shared libraries: libfrmwrk.so: cannot open shared object file: No such file or directory
As I said before, if I'm running it directly from eclipse everything works.
How can I run my program from terminal?
How is Linux supposed to know where to find libfrmwrk.so, if you don't put that either where it normally looks nor tell it where it can be found.
Eclipse seems to set up the paths the runtime linker looks into so, that when your program is loaded, the runtime linker knows where to find your libfrmwrk.so and so on.
You'll either have to
install these libraries (.so's) so that they are found in default locations, or
set LD_LIBRARY_PATH to contain all the folders to look into.
I haven't worked with Eclipse CDT in ages, but you can by now probably export some project formats that allow you to easily install things.
Another thing: It seems you're running software you're still debugging as root: That is a terrible idea, and if it can be avoided, avoid it.
I finally figure it out!
Refere to Marcus Muller's answer + my steps this is how I have fixed it ( all steps via terminal):
Create new directory in my workspace directory and called it libs.
In each one of your projects do: right click > c/C++ Build > Build Steps (tab) and in Post-build steps paste this:
cp ${BuildArtifactFilePrefix}${BuildArtifactFileName} "${WorkspaceDirPath}/libs/"
This code copy the so files directly into your libs directory when you compile your program.
And finally, in your terminal execute this:
export LD_LIBRARY_PATH=/builds/BaseCppProject/libs/
Now you can run your program via terminal.

cygwin1 dll when opening exe

I created a program using C++ with netbeans on my computer. I would like the exe file to open somewhere else. It opens all fine on my computer, but i tested it on a computer in school without netbeans or cygwin. After doing research, i attempted to put a cygwin1.dll file in the same directory as my exe but that just breaks the exe even on my computer.
What is the best way to do this, from another computer? Here are some options i have so far:
1. Install cygwin.dll file on System 32
2. change variable path (Not sure what the path is, but i will find out)
Some options i want to avoid:
1. Installing netbeans or cygwin
Extra notes:
only issue i have is opening the compiled .exe file from another computer
all computers will be using windows
Links i have looked at
http://www.dll-files.com/dllindex/dll-files.shtml?cygwin1
http://pcsupport.about.com/od/findbyerrormessage/a/cygwin1-dll-not-found-missing-error.htm
Unfortunately the executable will search for cygwin.dll by name so renaming it will not work. Also, putting stuff in System32 is a bad idea mainly for security reasons (you don't want to update the school's IT department) and it's possible to mess the machine up by playing around in that folder. Changing the path is ok but, again, the permanence of the change means you should shy away from it.
If I were you, I'd create a .bat file, say myapp.bat which has the lines
set PATH=%PATH%;<location>
<myapp>
where <location> is the location of cygwin.dll and <myapp> is the full path to your executable (including the file name).
You could then double click on this batch file. The first line in this file updates the path by appending the location of the dll but only in a way pertinent to that particular session. Make sense?

Can I point my project to a locally stored glut.dll?

I have a c++ opengl project that uses glut. It runs fine in my computer, but I need to be able to run it on a lab computer. When I try to do this, it tells me the glut.dll is not installed, but I do not have the privileges to put the file in the proper system folder on the computer. Is there anyway I can store the file with my game, and point to it in my project?
Thanks
Add required dlls to your project and set property to copy local.
Executable looks for dlls in folders listed in $PATH and in the folder with exe file.

Qt not working correctly

I have just installed Qt_SDK_Win_offline_v1_1_4_en.exe and run QT Creator.
I am working on Win7 64 bit.
I wanted to make simply app with form and button on it to test Qt. I choose New->Project QT Widget->Aplikacja Gui QT ---> then Desktop application.
When I run Play Button - that should build and run the application I get a message: that I should check path and privileges. I can't also run the exe files as administrator manually because windows give me message that I don't have privileges. I gave full privileges in file Properties but then after run I am getting error that I don't have mingwm10.dll.
I gave full privileges in file Properties but then after run I am getting error that I don't have mingwm10.dll.
This means the library required can't be found in any of the locations Windows searches to find libraries. The usual method to get around this is by making sure the folder containing the copy of mingwm10.dll which the Qt SDK installs is in your PATH environment variable. Here is one of the many Google-able guides to settings those variables.
Ok, I found a partial solution, I could finally run the exe file.
First, something must have changed in my Windows7 because every new created folder (and files in it)had restrictions and noone could make all operations.
So, after changing properties of folder, I got message about missing dlls files, so I started to copy them from QT folder. There are at least a few different versions of each dll, and only one is correct, so I copy those form mingw folder bacause I used mingw compiler, and finally after copying 4-5 dll I run the exe file.
But this is not what I am expecting from app that install pack has almost 2GB...
thanks
m.

Where do data files go so the Microsoft Visual C++ 2008 debugger can find them?

I am writing code that opens an istream object on a file specified by the user. I want to be able to run the program in the debugger and just type the filename (eg data.txt) at the prompt, not the whole path. I haven't worked out how to do this inside the IDE so I have been saving my .txt file to the debug folder and running the .exe file, but that means I can't step through the program. How do I make it work inside the IDE instead? Thanks.
you can set the working path of the executable (project properties->Debugging->Working Directory), which leads the debugger to start the executable with that path as working directory. This has the advantage that if you set the same path for all your configurations (Debug/Release/...), you only need 1 data.txt on your entire system, which is especially nice if you want to change data.txt or it's name.
I am not sure I understand exactly the problem - is it that your data file is part of the project, but is not in the executable folder when you access it, or is it that the datafile is at another location? If the former, and the data file is part of the project, right-click on the file, and set the Build Action property to "Content". That way, it will get copied to the bin/debug folder where the executable runs when you debug.