Solved

Errors building samples in MSVC++5

Posted on 1997-11-26
4
290 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

831 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