-1

I need to add a folder named "include" and a wine executable "fasm.exe" to Environment Variables.

The Include folder contains .inc files that are important for code execution. Although I am on Assembly, the purpose of this include folder is quite the same as that of the C include folder.

This was quite simple in Windows but I can't figure out a way to do that permanently in Ubuntu 17.10 .

ASK Arjun
  • 1
  • 4
  • I recommend looking into .bashrc files... – NerdOfCode Mar 17 '18 at 04:01
  • .bashrc is in my Home folder. What to do after that? – ASK Arjun Mar 17 '18 at 04:06
  • Add your environmental variables... For example, in the .bashrc file, I would have something like folder="folder_here"... And then after adding your variables to this file, run source ~/.basrhc... – NerdOfCode Mar 17 '18 at 04:08
  • I am not able to do it. Can you please post a complete way as I am new to Ubuntu – ASK Arjun Mar 17 '18 at 04:13
  • I just permanently need to add an "include" folder that has some header files like 'win32a.inc' so that I could compile my programs. Can someone help me by giving details on how to do it? – ASK Arjun Mar 17 '18 at 04:21
  • @NerdOfCode You need to export variables to put them in the environment. E.g. export folder="folder_here" – wjandrea Mar 17 '18 at 04:28
  • @wjandrea I see what you mean... – NerdOfCode Mar 17 '18 at 04:39
  • Are you possibly talking about adding stuff to the the already existing PATH environment variable? Your mentioning of an executable makes me think you are, and if so most of the discussion here so far does not address your question very well. – Gunnar Hjalmarsson Mar 17 '18 at 10:52
  • @GunnarHjalmarsson Consider adding a path as an environment variable. Can you help? – ASK Arjun Mar 17 '18 at 14:13
  • You'll want to read the wiki, at least the first few sections: https://help.ubuntu.com/community/EnvironmentVariables – wjandrea Mar 17 '18 at 16:13
  • 1
    Quite a few people might me able to help, I think, but you need to provide more information about the problem, such as why you need to add things to the environment. As a starter you may want to let us know the full path to both the executable and that "Include" folder. Also, please read the document which @wjandrea linked to. It may help you when rewriting the question. – Gunnar Hjalmarsson Mar 17 '18 at 19:31
  • @GunnarHjalmarsson So, I am an x86 Assembly Programmer. In windows when I needed to compile a program to create a portable executable I didn't need to worry about any missing '.inc' files because I added them to Environment Variables. So, I could compile my program from anywhere using fasm. I want to do the same with Ubuntu 17.10 . Add my INCLUDE folder that has '.inc' file to Environment Variables so that I could compile my programs from anywhere without worrying about missing '.inc' headers. Please sir, get back to me if you need any more details and thanks so far. – ASK Arjun Mar 17 '18 at 23:28
  • That's over my head, I'm afraid. I know there are environment variables which are useful for C compiling, but I have no idea about Assembly. But it indeed clarifies your question, and I'd advise you to edit the question and include that info. That way more people will notice your additional information. – Gunnar Hjalmarsson Mar 18 '18 at 01:09

1 Answers1

2

To give you some background, Ubuntu 17.10 uses Wayland by default, which doesn't have environment variables per se since it doesn't run a shell (more info here: GNOME, Wayland, and environment variables). If you're open to switching to Xorg, refer to this question: How do I set environment variables? Otherwise, read on.

If the environment variables are needed for a command-line program, and you use Bash, you can edit your ~/.bashrc file. Add lines like this for example:

export FOLDER=~/include

If the environment variables are needed for a graphical program, I think you can use this method from the Ubuntu wiki:

Launching desktop application with an environment variable

You can add an environment variable to an application by editing its .desktop file. For example, to run "digiKam" with the environment variable APPMENU_DISPLAY_BOTH=1, find the corresponding digikam.desktop file and add the setting of the variable, via the env command, to the entry "Exec":

Exec=env APPMENU_DISPLAY_BOTH=1 digikam -caption "%c" %i
wjandrea
  • 14,236
  • 4
  • 48
  • 98
  • export FOLDER=~/include. My include folder is in desktop/This\ PC – ASK Arjun Mar 17 '18 at 04:59
  • How to export from this location? – ASK Arjun Mar 17 '18 at 05:01
  • @ASKArjun That's a relative path. What is the absolute path? It's not supposed to be a relative path, is it? – wjandrea Mar 17 '18 at 05:05
  • Absolute path:/home/fs0c13ty/Desktop/This PC/Softwares/fasmw/INCLUDE – ASK Arjun Mar 17 '18 at 05:09
  • @ASKArjun OK, then you would use export FOLDER=~/Desktop/This PC/Softwares/fasmw/INCLUDE – wjandrea Mar 17 '18 at 05:10
  • Respected sir, @wjandrea This is a scrnshot of my .bashrc https://ibb.co/j6xU7x The terminal is still unable to find INCLUDE – ASK Arjun Mar 17 '18 at 05:20
  • @ASKArjun Whoops, I missed the space. Use export FOLDER=~/"Desktop/This PC/Softwares/fasmw/INCLUDE" – wjandrea Mar 17 '18 at 05:30
  • I am so sorry for disturbing again and again but still INCLUDE is not added to Environment Variables – ASK Arjun Mar 17 '18 at 05:38
  • @ASKArjun OK, please edit your question to clarify, what environment variables do you need to set, and what should their values be? – wjandrea Mar 17 '18 at 16:09
  • When I was on Windows, I went to Environment Variables and added an INCLUDE folder that has .inc files that I use when I compile my programs to obtain a windows portable executable. This INCLUDE folder in ENVIRONMENT VARIABLES is essential as I can compile my programs from anywhere without worrying about missing headers. So, in Windows I just added a path. Is there a way to do that in Linux? Thanks for the help so far :))) – ASK Arjun Mar 17 '18 at 23:32
  • @ASKArjun Welcome, but please edit your question to add details. – wjandrea Mar 17 '18 at 23:33