简体   繁体   English

工作目录Win32 Visual Studio

[英]working directory win32 visual studio

I have createprocess witch lpCurrentDirectory is Set to NULL . 我有createprocess巫婆lpCurrentDirectory设置为NULL I have changed my working directory to ..\\Debug in property window. 我在属性窗口中将工作目录更改为..\\Debug 在此处输入图片说明

Then create process finds .exe file and program works without problems. 然后,创建过程将找到.exe文件,程序可以正常工作。 Then I push my program with git to server. 然后我用git将程序推送到服务器。 Then I create folder and clone from server that program. 然后,我创建文件夹并从服务器克隆该程序。 Problem is that when I or any other person clones that program working directory changes to default. 问题是当我或其他任何人克隆该程序时,工作目录将更改为默认目录。 在此处输入图片说明

Then createprocess can't find .exe file. 然后createprocess找不到.exe文件。 Most important thing here is that program must run on other computers without any modifications. 这里最重要的是,程序必须在其他计算机上运行,​​而无需进行任何修改。 So my questions would be: 所以我的问题是:

  • How can I make my working directory permanent? 如何使工作目录永久化?
  • if It can't be done what other options to this problem i have? 如果无法解决此问题,我还有其他选择吗? And how to implement them? 以及如何实施它们?

Most important thing is that paths can't be written like this L"G:\\CppProjects\\ConsoleApplication1" because it won't work from other directory or other computers without small modifications. 最重要的是,路径不能像这样写成L“ G:\\ CppProjects \\ ConsoleApplication1”,因为如果不作小小的修改就无法在其他目录或其他计算机上运行。 Any ideas are wellcome. 任何想法都是好主意。

The Debugging settings for Visual Studio projects are considered user-specific, not project-specific. Visual Studio项目的调试设置被认为是特定于用户的,而不是特定于项目的。 This is because these settings very often contain paths which are only guaranteed to exist on the workstation which sets them up. 这是因为这些设置通常包含只能保证在设置它们的工作站上存在的路径。 By design and by default, these settings are not committed to source control. 根据设计,默认情况下,这些设置不提交给源代码管理。

You CAN share these things by putting the whatever.vcxproj.user file (from the same directory as whatever.vcxproj ) into source control. 您可以通过将共享这些东西whatever.vcxproj.user文件(从同一目录whatever.vcxproj )到源代码控制。 I wouldn't recommend doing that, however, because this file contains not only debugging settings, but also other workstation/user-specific settings that you may find problematic to share. 但是,我不建议您这样做,因为此文件不仅包含调试设置,而且还包含其他共享特定工作站/用户特定设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM