简体   繁体   中英

Link: fatal error LNK1561: entry point must be defined VS2015 developer cmd window

I have read a ton of this same question, but I appear to be doing everything correctly as all suggestions advise, but am still getting this error.

I have simple .cpp and .h files in C++ using Visual Studio 2015. My program runs perfect from the gui. I need to run it in the visual studio developer command window to get the results there, this is a verified console application. I have copied the files to their own directory using:

C:\RunDirectory>copy C:\SaveDirectory\

The system verifies that it copies all 15 files.

When I run this command:

C:\RunDirectory>cl Aprogram.cpp

Then I get the error.

I have a main that is returning an int, and this is a console application with the correct linker settings: Console (/SUBSYSTEM:CONSOLE)

Any ideas? I'm pretty stumped.

This is my driver file:

#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include "JollyBanker.h"

  using namespace std;

int main()
{
        JollyBanker theBanker;
        theBanker.BuildQueue("BankTransIn.txt");
        theBanker.ProcessQueue();
        theBanker.DisplayResults();

        return 0;
}

File Aprogram.cpp is a source code file, which is compiled and linked into an executable by Visual Studio IDE. Assuming that default project settings are used, this executable is located in "Debug" or "Release" subdirectory of the directory that contains your solution and it is named ProjectName.exe (where "ProjectName" is the name of the project within the solution that contains Aprogram.cpp )

Also, you mentioned that you want to make sure it works outside VS. Note that if you have used the default settings, you will have problems when you run this executable on another machine. To solve this, I suggest that you change the runtime library that you are linking to. To do this, right click on the project in Solution Explorer and select "Properties". Go to "C/C++" -> "Code Generation" and change the value of "Runtime Library" to "Multi-threaded Debug (/MTd)" for "Debug" configuration, or to "Multi-threaded (/MT)" for "Release" configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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