Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使工作目录成为“解决方案目录”,但不是通过属性,而是通过代码?
我在 Windows 中工作。
如果您的意思是要查找其中包含 .sln 文件的目录并使用它,那么 C++ 中没有诸如 .sln 或 Makefile 之类的概念,或者在构建中真正使用的任何其他东西编译项目的过程。
这个概念是您正在构建机器代码以在没有特定运行时环境的情况下运行,尽管它可能需要在运行时找到其他库。
您可以将路径或 .sln 文件的名称硬编码,然后让程序在文件系统中搜索它以防万一,但仅此而已。