Ace application link Error error lnk2019 Solution

Source: Internet
Author: User
Ace application link Error error lnk2019 Solution
 

Reader level: elementary
Abstract: The text briefly shows how to correctly compile and link ace applications.

For beginners, the ace development environment will be a mystery. How to correctly configure the developer machine and quickly experience ace,
Is the purpose of this series of articles. This article only addresses how to solve the lnk2019 Error

Environment:

Ace version 5.5.1
Windows XP Professional SP2
Development Environment Microsoft Visual C ++ 2005 77626-009-0000007-41235



The following code is the main program of the service.

// @ File: registerserver. cpp:
// @ Description: defines the entry point for the gameservice daemon application.
// @ Date: 2006-07-06
// @ Author: jiangtao <2005119@gmail.com>
# Ifdef _ debug
# Define ace_ndebug 0
# Define ace_ntrace 0
# Endif
# Include "stdafx. H"
# Include "ACE/filecache. H"
# Include "ACE/log_msg.h"
# Include "ACE/OS _ns_signal.h"
# Include "ACE/service_config.h"

# Ifdef ace_has_sig_c_func
# Pragma message ("ace_has_sig_c_func ")
Extern "C"
{
# Endif/* ace_has_sig_c_func */

// Call exit () so that static Destructors get called
Static void
Handler (INT)
{
Delete (ace_filecache *) ace_filecache: instance ();
Ace_ OS: exit (0 );
}

# Ifdef ace_has_sig_c_func
}
# Endif/* ace_has_sig_c_func */

Int ace_tmain (INT argc, ace_tchar * argv [])
{
Ace_debug (lm_info, ace_text ("Start Service/N ")));
Ace_service_config daemon;

Ace_ OS: Signal (sigchld, sig_ign );

// Sigaction not needed since the handler will shutdown the server.
Ace_ OS: Signal (SIGINT, (ace_signalhandler) handler );
Ace_ OS: Signal (sigusr2, (ace_signalhandler) handler );

If (daemon. Open (argc, argv, ace_default_logger_key, 0 )! = 0)
Ace_error_return (lm_error, "% P/N", "open"), 1 );

// The configured service creates threads, and
// Server won't exit until the threads die.

// Run forever, specify the configured services until we receive
// A Sigint.

Return 0;
}

Configuration File loaded by the Service

 


######################################## #######################################
# File SVC. conf
######################################## #######################################

Dynamic gameservice service_object * gameservice: _ make_gameserver_t () Active

 

Error prompt:

 

----- Build started: Project: registerserver, configuration: Debug Win32 ------
Compiling
Registerserver. cpp
Linking
Registerserver. OBJ: Error lnk2019: unresolved external symbol "_ declspec (dllimport) int _ cdecl ace_ OS _wmain_ I (class ace_main_base &, Int, wchar_t ** const)" (_ imp _? Ace_ OS _wmain_ I @ yahaavace_main_base @ hqapa_w @ Z) referenced in function _ wmain
Registerserver. OBJ: Error lnk2019: unresolved external symbol "_ declspec (dllimport) Public: static int _ cdecl ace_service_config: open (INT, wchar_t ** const, wchar_t const *, Int, int, INT) "(_ imp _? Open @ ace_service_config @ sahhqapa_wpb_whhh @ Z) referenced in function "int _ cdecl ace_wmain_ I (INT, wchar_t ** const )"(? Ace_wmain_ I @ yahhqapa_w @ Z)
D:/ace_output/Game // registerserverd.exe: Fatal error lnk1120: 2 unresolved externals
Build log was saved at "file: // D:/my sources/registerservice/registerserver/debug/buildlog.htm"
Registerserver-3 error (s), 0 warning (s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ========

 

Problem Analysis
The error message is displayed. The ace_ OS _wmain_ I () and ace_service_config: open () functions cannot be parsed ().
From this we can see that the linker requires the Unicode version of the ACE library, and we did not generate wide characters when generating the ace.
Unicode version.

Solution:
Open the properties page of the project, find the configuration properties, and select multi-Byte Character Set in the character set. Re-compile and solve the problem.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.