C ++和Lua从USB [英] C++ and Lua from USB

查看:186
本文介绍了C ++和Lua从USB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以大约2周前,我开始学习C ++和Lua,我想能够:


  1. 编译C ++代码(这将是一个不错的奖金,如果我可以有一个C编译器,因为这是下一个我的语言列表学习)

  2. 解释(是正确的术语吗?)Lua,

  3. 从我的usb驱动器做所有这些,不从互联网下载任何东西或更改路径变量。

另一方面,我喜欢Sublime Text 2便携式版本已经在我的usb驱动器)。如果它是绝对必要的,我会做没有它,但我宁愿能够使用它,无论我去哪里。



请耐心与我,因为我有前面提到的,我刚开始学习如何编程,我几乎没有什么知识如何工作。 我已经看过类似的问题,但由于我的知识有限,他们似乎不会帮助我。,请不要无情地关闭我在这个网站上看到的其他问题。

$

解决方案

我最近添加了 Lua WIKI (伟大的信息来源),可能会帮助你。这是一个完整的新手如何使用免费和便携式(在可以放在USB驱动器的意义上)的工具从源头构建Lua的教程。它适用于Windows操作系统用户。不要忘记查看官方的入门页面和主Lua网站以及!



你不能下载任何东西的事实是相当限制你得到一个免费的编译器然后?)。无论如何伟大的狼提到TDM-GCC是一个伟大的C / C ++编译器为32位的x86电脑。它也被修补为完美的便携:我通常使用它从便携式USB高清。我提到的教程告诉你如何下载它和安装它。



请注意,虽然学校的系统管理员可能已阻止您全局更改路径变量的能力,但您可以使用简单批处理为单个进程(启动程序



使用此内容创建一个名为myshell.cmd的文件:

  @set path =%path%; c:\the\path\to\my\app& cmd / K 

部分 c:\the\path\to\my\app 必须是放置应用程序可执行文件的目录(文件夹)的实际路径。当您双击 myshell.cmd 时,将打开一个黑框(假设您的系统管理员尚未阻止此功能),您可以在其中调用应用可执行文件。



例如,如果在该目录中的 c:\myprogs\GCC 中安装TDM_GCC编译器,一个名为 bin 的子目录。该subdir必须放在路径中,因此您的 myshell.cmd 文件将是这样:

  @set path =%path%; c:\myprogs\GCC\bin& cmd / K 

然后在黑盒子中我提到你可以调用编译器键入:

  gcc --help 

至于你的学习路径,如果你打算学习Lua和C或C ++,我会建议你尝试C而不是C ++。 C ++有更多的高级功能,但它是巨大的,虽然Lua可以嵌入在C ++代码中(当然这是一个高级主题),它被设计为直接嵌入在C应用程序(它有一个API符合C约定),所以对于初学者来说,路径Lua - > C - > C + Lua会更容易一些。 C本身,虽然很难掌握,但是一个相当简约的语言,所以消化它的信息不是那么大。



不要劝阻你, C和C ++不是绝对初学者最合适的语言(他们有很多陷阱,对初学者几乎没有安全网)。但是这取决于你,这在很大程度上取决于你的技能,奉献和激励; - )



希望这些都有帮助。


So about 2 weeks ago, I started learning C++ and Lua, and I would like to be able to:

  1. compile C++ code (it would be a nice bonus if i could have a C compiler as well, as that's next on my list of languages to learn)
  2. interpret (is that correct terminology?) Lua, and
  3. do all of this from my usb drive WITHOUT downloading anything from the internet or changing the path variable. (I will mostly be working on school computers.)

As a side note, I have fallen in love with Sublime Text 2 (the portable version of which is already on my usb drive). If it's ABSOLUTELY necessary, I'll make do without it, but I would prefer being able to use it wherever I go.

Please be patient with me, as i have mentioned before, I just started learning how to program, and I have little to no knowledge on how things work. I have seen similar questions, but they never seem to help me much due to my limited knowledge, so PLEASE don't mercilessly close my question like others I have seen on this site.

Thank you in advance!

解决方案

I recently added a page on Lua WIKI (great source of info) that may help you. It is a tutorial for complete newbies on how to build Lua from the sources using only free and "portable" (in the sense of "can be put on usb drives") tools. It is meant for Windows OS users. Do not forget to check the official getting started page and the main Lua site as well!

The fact that you cannot download anything is quite restrictive (how could you get a free compiler then?). Anyway as greatwolf mentioned TDM-GCC is a great C/C++ compiler for 32 bit x86 PCs. It is also patched to be perfectly "portable": I usually use it from a portable USB HD. The tutorial I mentioned shows you how to download it and "install it".

Note that although your sysadmin at school may have blocked your ability to change the path variable globally, you can set it for individual processes ("launched programs") using simple batch files (aka Windows command shell scripts).

Create a file named "myshell.cmd" with this content:

@set path=%path%;c:\the\path\to\my\app&cmd /K

the part c:\the\path\to\my\app must be the actual path of the directory (folder) where the application executable is placed. When you double-click on myshell.cmd a black box will open (assuming your sysadmin hasn't blocked this feature) where you can invoke the app executables.

For example, if you "installed" the TDM_GCC compiler in c:\myprogs\GCC inside that dir you will find a subdir named bin. That subdir must be put in the path, so your myshell.cmd file will be like this:

@set path=%path%;c:\myprogs\GCC\bin&cmd /K

Then in the "black box" I mentioned you can invoke the compiler typing:

gcc --help

As for your learning path, if you intend to learn both Lua and C or C++, I will advice you to try C instead of C++. C++ has more "high-level" features, but it is huge and although Lua can be used embedded in C++ code (of course this is an advanced topic anyway), it is designed to be directly embedded in a C application (it has an API which conforms to C conventions), so for a beginner probably the path Lua --> C --> C+Lua would be a bit easier. C in itself, although difficult to master, is a rather minimalistic language, so the information to digest about it is not that big.

Not to discourage you, but IMO both C and C++ are not the most suitable languages for absolute beginners (they are plenty of pitfalls and have almost no "safety nets" for beginners). But that's up to you, it heavily depends on your skills, dedication and motivation ;-)

Hope all this helps.

这篇关于C ++和Lua从USB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆