Solved

Errors building samples in MSVC++5

Posted on 1997-11-26
4
282 Views
Last Modified: 2012-08-13
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;
Compiling...
WIZARD.C
Linking...
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)
0
Comment
Question by:bradster
  • 2
4 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1174164
Just rename all .c file into .cpp files. This problem is caused by compiler so it creates different obj file for c and cpp.
0
 

Author Comment

by:bradster
ID: 1174165
Renaming *.c to *.cpp is not the solution, it causes even more errors (and still won't build) sorry.  Anyone else?
0
 
LVL 23

Accepted Solution

by:
chensu earned 20 total points
ID: 1174166
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.
0
 

Author Comment

by:bradster
ID: 1174167
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!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now