-1

I have learned the basics of C++ but I have never used visual studio.

I would like to know why I get popup window that says "Unable to start program" and then lists a file path C:\folder\folder\folder\../../lib/Win32DB/ProjectNameDB.lib. (The message doesn't give me any more info, like 'the system cannot find the file specified' or anything like that.)

ProjectNameDB.lib exists, but not at that particular location. The project builds successfully, and the same path as above appears in the output after TargetPath =.

I have tried setting the project as startup, deleting .suo files and vcproj.user files, starting without debugging, and putting the location of ProjectName.lib in the Output, Library, Include, Reference Directories.

4

2 回答 2

0

你不能开始一个*.lib,但一个*.exe。因此,构建一个 EXE 程序,您应该在 Visual Statio 2013 中使用以下步骤:

  1. 开始vs2013;

  2. 选择文件->新建->项目;

  3. 选择 Win32 控制台应用程序,并输入您的项目名称,单击确定;

  4. 点击下一步,点击完成;

  5. 现在,你可以在'x.cpp'中写“Hello World”(这里'x'是你的项目名称);以下代码:

    int main(int argc, _TCHAR* argv[])
    {
        printf("Hello Wrold!\n");
        return 0;
    } 
    
  6. 保存,构建并开始运行它,它将在控制台中打印“Hello World”。

exe文件必须有main功能,但lib文件不是必需的。

于 2015-04-03T00:56:26.687 回答
0

所以......问题是该项目被配置为作为静态库而不是作为可执行文件运行。属性 -> 配置属性 -> 常规

于 2015-04-17T00:11:27.717 回答