473,770 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Won't compile a Windows program

I've been following the tutorial here to learn Windows programming (along
with the help file from the Windows Platform SDK):

http://www.cprogramming.com/tutorial...ogramming.html

and when I try compiling the code given in this tutorial (even using copy
paste instead of manually typing it), I keep getting errors that prevent me
from compiling it. At first, it was because windows.h couldn't be found, but
that issue was resolved and now I've got one thing that is very confusing.
When I build, I get the error "unresolved external symbol". This is the
build log I get:

------ Build started: Project: Windowsapptest, Configuration: Debug Win32
------
Compiling...
firsttest.cpp
Linking...
firsttest.obj : error LNK2019: unresolved external symbol
__imp__MessageB oxA@16">__imp__ MessageBoxA@16</areferenced in function <a
href="mailto:_W inMain@16
C:\My Documents\My programs\Window sapptest\Debug\ Windowsapptest. exe : fatal
error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\My Documents\My
programs\Window sapptest\Window sapptest\Debug\ BuildLog.htm"
Windowsapptest - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have Windows XP Pro SP2 and Visual C++ 2005 Express. From another forum,
I quite some help, but I was later told to ask elsewhere so I figured I'd
post here. You can see the details (and a few screenshots) here:

http://forums.howwhatwhy.com/showthr...&view=&sb=5&o=

How can I fix this?

--
Some programming:
void bluewater() {while(game_run s == 1)
{if fox.position == in_blue_water) {fox.health -= 1;}
else {fox.wants_to_g et_wet = true;} wait_frames(1); }}
Dec 3 '06 #1
6 2945
"ulillillia " <ul********@dis cussions.micros oft.comwrote in message
news:03******** *************** ***********@mic rosoft.com...
I've been following the tutorial here to learn Windows programming (along
with the help file from the Windows Platform SDK):

http://www.cprogramming.com/tutorial...ogramming.html

and when I try compiling the code given in this tutorial (even using copy
paste instead of manually typing it), I keep getting errors that prevent
me
from compiling it. At first, it was because windows.h couldn't be found,
but
that issue was resolved and now I've got one thing that is very confusing.
When I build, I get the error "unresolved external symbol". This is the
build log I get:

------ Build started: Project: Windowsapptest, Configuration: Debug Win32
------
Compiling...
firsttest.cpp
Linking...
firsttest.obj : error LNK2019: unresolved external symbol
__imp__MessageB oxA@16">__imp__ MessageBoxA@16</areferenced in function <a
href="mailto:_W inMain@16
C:\My Documents\My programs\Window sapptest\Debug\ Windowsapptest. exe :
fatal
error LNK1120: 1 unresolved externals
So, you call MessageBox() in your application? IAC, the linker is telling
you that it can't be found. Look up the function on the MSDN site. You find
the definition here:

http://msdn.microsoft.com/library/de...messagebox.asp

Scroll down to the bottom of the page and you'll see that it requires the
USER32.LIB import library. Add that to the list of objects and libraries in
the linker's properties page and relink.

Of course, that presumes that you have downloaded the Windows software
development kit (SDK). Have you done that?

Regards,
Will
Dec 3 '06 #2
Yes, I have downloaded the Windows Platform SDK (R2) and installed it. I saw
that you need the user32.dll and/or user32.lib files. Thing is, how do you
link a library? An include?

Do note that I started with "empty project" or the like when I started this
temporary learning project. Much of the configuration stuff seems to be left
blank or empty. Don't bother mentioning to switch to "Win32 project" or
whatever as I don't have that available ("Windows console project" and
"Windows forms project" are the only two available). The only option I had
was to start with a empty project.

--
Some programming:
void bluewater() {while(game_run s == 1)
{if fox.position == in_blue_water) {fox.health -= 1;}
else {fox.wants_to_g et_wet = true;} wait_frames(1); }}
Dec 3 '06 #3
"ulillillia " <ul********@dis cussions.micros oft.comwrote in message
news:AD******** *************** ***********@mic rosoft.com...
Yes, I have downloaded the Windows Platform SDK (R2) and installed it. I
saw
that you need the user32.dll and/or user32.lib files. Thing is, how do
you
link a library? An include?
You are using the Express Edition?

If so, choose Project->Properties from the menu. Click on the '+' to expand
the 'Configuration Properties', then open up the 'Linker' options the same
way, click on the 'Input' category, then in the edit box labeled 'Additional
Depencies' type

user32.lib

Regards,
Will
Dec 3 '06 #4
You should do like below steps:

Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.

Add the paths to the appropriate subsection:

Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin

Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include

Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

Note: Alternatively, you can update the Visual C++ Directories by modifying the VCProjectEngine .dll.express.co nfig file located in the \vc\vcpackages subdirectory of the Visual C++ Express install location. Please make sure that you also delete the file "vccomponents.d at" located in the "%USERPROFILE%\ Local Settings\Applic ation Data\Microsoft\ VCExpress\8.0" if it exists before restarting Visual C++ Express Edition.

Update the corewin_express .vsprops file.

One more step is needed to make the Win32 template work in Visual C++ Express. You need to edit the corewin_express .vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectD efaults) and

Change the string that reads:

AdditionalDepen dencies="kernel 32.lib" to

AdditionalDepen dencies="kernel 32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"

Generate and build a Win32 application to test your paths.

In Visual C++ Express, the Win32 Windows Application type is disabled in the Win32 Application Wizard. To enable that type, you need to edit the file AppSettings.htm file located in the folder ¡°%ProgramFiles %\Microsoft Visual Studio 8\VC\VCWizards\ AppWiz\Generic\ Application\htm l\1033\".

In a text editor comment out lines 441 - 444 by putting a // in front of them as shown here:

// WIN_APP.disable d = true;
// WIN_APP_LABEL.d isabled = true;
// DLL_APP.disable d = true;
// DLL_APP_LABEL.d isabled = true;

Save and close the file and open Visual C++ Express.

From the File menu, click New Project. In the New Project dialog box, expand the Visual C++ node in the Product Types tree and then click Win32. Click on the Win32 Console Application template and then give your project a name and click OK. In the Win32 Application Wizard dialog box, make sure that Windows application is selected as the Application type and the ATL is not selected. Click the Finish button to generate the project.

As a final step, test your project by clicking the Start button in the IDE or by pressing F5. Your Win32 application should build and run.
--------------------------------------------------------------------------------
"William DePalo [MVP VC++]" <wi***********@ mvps.orgдÈëÏûÏ ¢ news:uC******** ******@TK2MSFTN GP03.phx.gbl...
"ulillillia " <ul********@dis cussions.micros oft.comwrote in message
news:AD******** *************** ***********@mic rosoft.com...
Yes, I have downloaded the Windows Platform SDK (R2) and installed it. I
saw
that you need the user32.dll and/or user32.lib files. Thing is, how do
you
link a library? An include?
You are using the Express Edition?

If so, choose Project->Properties from the menu. Click on the '+' to expand
the 'Configuration Properties', then open up the 'Linker' options the same
way, click on the 'Input' category, then in the edit box labeled 'Additional
Depencies' type

user32.lib

Regards,
Will
Dec 3 '06 #5
I'm very confused with the first part - setting the directories. I don't see
any of the "C:\Program Files\..." stuff, but other things that makes me very
confused. As an example, I see this in that file you mentioned:

Include="$(VCIn stallDir)includ e;$(VCInstallDi r)PlatformSDK\i nclude;$(Framew orkSDKDir)inclu de"

I don't get what any of this means and as a result, I have no idea what I
need to do. I first used the options dialog stuff, but I saw this same thing
without the familiar "C:\Program Files\..." stuff. What do I do and where do
I put the additions I need. I don't see any "executable files" listed in
that file. Given the top line, it appears as if this is an XML file, the
first time I've actually seen such a file (which seems a lot like HTML only
with odd symbols and formatting (the dollar sign)).

I haven't done anything else past this first part since I feel as if I need
to do them in the order you've given.

Thanks so far though for the assistance, but I'm just very confused on the
first part I need to do.

--
Some programming:
void bluewater() {while(game_run s == 1)
{if fox.position == in_blue_water) {fox.health -= 1;}
else {fox.wants_to_g et_wet = true;} wait_frames(1); }}
Dec 4 '06 #6
Okay, so I tried just copying and pasting the URL using the dialog through
the options menu instead of being confused with the weird formatting. That
appeared to have worked properly and I began following the other directions
you had and it all works. Thank you so much for the assistance and I can now
begin learning Windows programming and eventually get into game programming
when my ability gets good enough.

--
Some programming:
void bluewater() {while(game_run s == 1)
{if fox.position == in_blue_water) {fox.health -= 1;}
else {fox.wants_to_g et_wet = true;} wait_frames(1); }}
Dec 5 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
3785
by: Christopher | last post by:
I am getting a parse error from g++ pointing at my catch line and can't figure out whats wrong with this code: #include "BigPosInt.h" #include <iostream> #include <new> #include <assert.h> BigPosInt::BigPosInt(int init_max_digits) {
4
466
by: Vince | last post by:
I'm getting this message when I try and run a .net web app in the development system: CS0016: Could not write to output file 'c#:\windows nt\Microsoft..net framework\v1.1.4322\Temporary ASP.NET Files\ssrpttest\44d149b5\fdee4a07\c22wlbzl.dll' -- 'Access is denied. ' I just upgraded to visual studio .net 2003 and now none of my applications wil work!
1
1893
by: ping | last post by:
Hello everyone! I had already installed VC6.0 in my computer, then i installed the Vs.net. I wrote some programs of vs.net with the UtraEdit and compiled them in command line. For example, i wrote a program of Hello World with C# language: using System; class MainApp { public static void Main()
13
2678
by: developer | last post by:
re-compile under dev -c++ bloodshed. can u help ? #include<dos.h> #include<process.h> #include<io.h> #include<stdio.h> #define STROBE 0x01
11
3975
by: bart | last post by:
Hello, I'm so sorry, but i don't understand the concept of the .net environment yet. I made a simple program that retrieves the hostname and ipaddress of the local computer. But when i give thit .exe file to my friend he can't run it because he does not have the framwork 1.1 I thought that the this framework is just a large library of classes wich
3
3096
by: | last post by:
I am trying to compile a simple c# class in Web Matrix called howdy.cs: // Program start class public class HowdyPartner { // Main begins program execution public static void Main() { // Write to console
30
7710
by: MikeC | last post by:
Good People, I'm writing a backup utility that uses a chdir() to go into the source directory (in which the files reside that I want to back up), so I don't want to use chdir() to get into the target directory (where the backup copies will be kept, on another drive). I can successfully test whether the target directory exists or not using findfirst(), but if it doesn't, I wanted to create it using mkdir(), but it doesn't like the path...
0
3308
by: dot | last post by:
I spent a few headache filled days trying to use GMP on windows (XP pro) I finally got it to work and since I found little help on the Web I thought someone might find what i did useful. Creating an environment suitable for GMP programming. 1) Create 'cygwin' environment (see below) 2)add GMP to the cygwin directory (see below)
2
6661
myusernotyours
by: myusernotyours | last post by:
Hi All, Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also using Cygwin as my compiler (gcc), this is ostensibly because I hope this compiler will also compile the unix native libraries since I don't have a Linux installation. (I am working on a personal project from the office and can't get linux installed)....
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.