关闭。这个问题需要更多 focused .它目前不接受答案。
想改进这个问题?更新问题,使其仅关注一个问题 editing this post .
6年前关闭。
Improve this question
我曾经在 Windows 中使用 Microsoft Visual C++ 进行编程,我需要使我的一些可移植程序(用可移植 C++ 编写)成为跨平台的,或者至少我可以为 Linux 和 Windows 发布我的程序的工作版本。
我是 Linux 应用程序开发的新手(很少使用操作系统本身)。
所以,今天,我安装了 Ubuntu 10.04 LTS(通过 Wubi)并配备了带有 g++ 编译器的 Code::Blocks 作为我的主要武器。然后我编译了我的第一个 Hello World linux 程序,我对输出程序感到困惑。
我可以通过 Code::Blocks 中的“构建和运行”菜单选项运行我的程序,但是当我尝试通过文件浏览器从外部启动编译的应用程序时(在/media/MyNTFSPartition/MyProject/bin/Release;是的,我将它保存在我的 NTFS 分区中),程序没有出现。
为什么?我没主意了。
我需要更改我的Windows
和 Microsoft Visual Studio
心态Linux
和 Code::Blocks
心态。
所以我想出了这些问题:
很抱歉问了很多问题,但我真的对这些 linux 开发基础感到困惑。
任何形式的帮助将不胜感激=)
谢谢。
最佳答案
How can I execute my compiled linux programs externally (outside IDE)? In Windows, I simply run the generated executable (.exe) file
在 Linux 上,你也这样做。唯一的区别是在 Linux 上,当前目录默认不在 PATH 中,所以通常你这样做:
./myapp
如果将当前目录添加到路径
PATH=".:$PATH"
然后像windows一样的方式
myapp
可以,但由于安全风险,不建议这样做,至少在共享环境中(你不想运行某人留下的/tmp/ls)。
How can I distribute my linux application? In Windows, I simply distribute the executable files with the corresponding DLL files (if any)
如果您认真对待分发,您可能应该了解 .deb(Ubuntu、Debian)和 .rpm(RedHat、CentOS、SUSE)。这些是“包”,使用户可以轻松地使用特定于分发的方式安装应用程序。
还有一些安装程序项目的工作方式与 Windows 安装程序生成器类似,但我建议先研究前一种路径。
What is the equivalent of LIBs (static library) and DLLs (dynamic library) in linux and how to use them?
.a(静态)和 .so(动态)。您使用它们的方式或多或少与在 Windows 上相同,当然使用 gcc 特定的编译选项。我不使用 Code::Blocks 所以我不知道他们的对话框是什么样子的,最后它是关于将 -llibrary 添加到链接选项(猜猜看:在 Windows 上它是关于添加/llibrary ;-))
Is it possible to use the "binary form" of a C++ library (if provided) so that I wouldn't need to recompile the entire library source code?
是的。许多库已经存在于发行版中。
另请注意,如果您使用 .deb 和 .rpm 进行分发,您可以说“我的应用程序需要安装这样和这样的库”,它们将从分发文件中安装。这是推荐的方式,一般来说你不应该分发你的库拷贝。
If I want to create a wxWidgets application in Linux, which package should I pick for Ubuntu? wxGTK or wxX11? Can I run wxGTK program under X11?
首先尝试 wxGTK,对话框可能看起来更好,应该使用 gnome 主题等。
If question no. 4 is answered possible, are precompiled wxX11/wxGTK library exists out there? Haven't tried deep google search.
尝试
apt-cache search wx
(或生成您的 Ubuntu 软件中心并搜索 wx)
简而言之:您会在分发文件中找到所需的一切。
关于c++ - 从 Windows 迁移到 Ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2754707/