• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Errors building samples in MSVC++5

I'm a beginner and that is why I can't solve this myself, not knowing code well enough to spot the errors.
The errors occur when I try to build certain samples which are included in the MSVC++5 Win32 samples folder.
(I've applied Visual Studio Service Pack-2, didn't help)

The errors allways occur when I try to build the samples/projects with *.c files in them, the samples that have *.cpp files don't cause these errors:
   "error LNK2001: unresolved external symbol"
   "fatal error LNK1120: unresolved externals"

I've done a search in InfoViewer on the error and it said it's probabily due to "external" or "inline" functions, but again I'm just learning and can't (at this point) spot the problem in the source code.
Could someone point out the code I need to adjust to allow these to build properly? or perhaps advise on how to do the build so they will not error.
I've tried building the projects two ways:
1.) simply clicking on the *.c file and answering "yes" to the prompt for a workspace.
2.) creating a project (Win32) and importing the files.
neither method builds the examples.

The examples (all have) the error:

Trying to build the "Wizard" example;
WIZARD.OBJ : error LNK2001: unresolved external symbol __imp__PropertySheetA@4
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WIZARD.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
WIZARD.exe - 3 error(s), 0 warning(s)

Trying to build the "generic" example;
GENERIC.exe - 5 error(s), 0 warning(s)

Trying to build the "Shell extension" example;
SHELLEXT.exe - 17 error(s), 0 warning(s)

Trying to build the "registry API" example;
MONKEY.exe - 2 error(s), 1 warning(s)

Trying to build the "Shell extension" example;
CDTEST.exe - 10 error(s), 0 warning(s)

Trying to build the "common dialogs" example;
COMDLG32.exe - 2 error(s), 0 warning(s)
  • 2
1 Solution
Just rename all .c file into .cpp files. This problem is caused by compiler so it creates different obj file for c and cpp.
bradsterAuthor Commented:
Renaming *.c to *.cpp is not the solution, it causes even more errors (and still won't build) sorry.  Anyone else?
Every example you tried has a file named MAKEFILE inside. Choose the menu File/Open Workspace and change the Files of type to All Files (*.*), then open the MAKEFILE. Thus, you can build the examples.
bradsterAuthor Commented:
That is the correct answer! good show 'chensu', I opened the file as you said and they built without errors.
The only thing I had to do was rename the 'makefile' because it causes the project to be named 'makefile' so I renamed 'makefile' to "<ProjectName>.mak"' and the samples built with the correct names!!!
Thanks 'chensu', good advise!!!

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now