Hey folks, I thought that recently I transitioned form NOOB to novice until I had this question. Oh, well.

Why can't I create an executable in Visual Studio 2005? I have my Win32 project code debugged and it builds a library object file, not .exe. I am in release mode and am checking the release folder of my project. Further, in the build options, there is no option to build myproject.exe.

Should I have created a console application instead?

Sincerely,

feeling like superNOOB;)

Dani AI

Generated

This thread shows a very common set of confusions with Visual C++ projects: project template + configuration choices determine whether the build invokes the librarian (creates a .lib) or the linker (creates an .exe), and the presence (and signature) of an entry point controls whether the linker can produce a runnable image. ran into that behavior; and touched on project type and rebuilding. A few focused checks clear this up quickly.

Verify the project property values that drive output and locations: the configuration type, the output directory, and the target name/extension. The Build/Output window shows the exact commands run and the final target path. A static-library project uses the librarian step and never runs the linker to emit an executable; an application project runs the linker and writes an .exe (or .dll for a DLL project). A clean + full rebuild is useful so the output log is unambiguous.

Entry-point and subsystem mismatches are the next common cause of new link errors after switching project type. Console apps need main/wmain; GUI apps need WinMain (or a proper entry point explicitly set). The Linker → System → SubSystem setting must match the entry point, or an explicit Entry Point can be provided under Linker → Advanced. Minimal examples:

int main()
{
    return 0;
}
#include <windows.h>

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    return 0;
}

Using the Win32 project wizard to create the correct type avoids manual mistakes. Also, when moving between Express and Standard editions or adding an SDK, verify include/library paths and the platform toolset so the linker finds the runtime. As noted, seeing the actual source that should provide an entry point and the exact linker error text is the fastest way to diagnose persistent problems.

Recommended Answers

All 11 Replies

Hey folks, I thought that recently I transitioned form NOOB to novice until I had this question. Oh, well.

Why can't I create an executable in Visual Studio 2005? I have my Win32 project code debugged and it builds a library object file, not .exe. I am in release mode and am checking the release folder of my project. Further, in the build options, there is no option to build myproject.exe.

Should I have created a console application instead?

Sincerely,

feeling like superNOOB;)

What project type did you choose? Oh, and noob is a mean term for people who refuse to learn. I don't think you fall under that category, so there's no way you could be one. :)

Thanks for the kind vote of confidence. My project is based on the "Win 32 application" template and C++. Is that enough info to help?

go project - rebuild all

then check the bin directory in the solution

There is no BIN directory in my solution area. I checked the BIN directories in program files as well, no such directory. I also did a file search from the start menu for executables in both My documents and the program files location - is not there.

Folks, an update: I was exepecting a .exe file and instead its outputing a .lib file. I feel I am missing a concept here.

Can you post the source code you're trying to compile?

Otherwise it should just be a simple switch or something. Perhaps you're just looking in the wrong directory.

Well, it looks like in Project-->Properties-->Project Configuration-->Configuration type I (or the program) had selected (.lib). In the drop down menu I just changed it to (.exe) for both debug and release configs. Now I am getting new errors in debug and will address them. My question is why did it select .lib ? Was that because of the Win32 app template I chose in the beginning?

Thanks

have you installed the platform SDK?

Yes. It built test apps for Visual Studio Express - no problem. Then I upgraded to VS standard. As far as I know the SDK install went well I made a few executables on the express.

Lol check my quote

>Lol check my quote

Tell me if I missed something, but what exactly was the point of your post? I can't find your "quote" anywhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.