我根本不熟悉链接错误所以我希望有人可以对这些错误有所了解......
我正在使用Legacy Ada计划。我正在开发一个C ++扩展,其中Ada将使用代理来调用C ++函数。 C ++干净利落地编译,没有任何警告。但是我收到以下Undefined Symbol错误:
#include "cppProxy.h"
extern classHandler *classPtr;
void processData(void* ioBuffer)
{
classPtr->processData(ioBuffer);
}
代码库如下:
#include "classHandler.h"
extern "C" void processData(void* ioBuffer);
标题文件:
extern "C"
{
classHandler* create()
{
return new classHandler;
}
void destroy(classHandler *p)
{
delete p;
}
}
void processData(*ioBuffer)
{
int idx;
data = static_cast<int*>(ioBuffer);
idx = (data[0] >> 16);
returnData[idx] = data;
}
classHandler.cpp
class classHandler
{
public:
classHandler();
~classHandler();
void processData(void* ioBuffer);
};
typedef classHandler classPtr;
typedef void destroy_t(classHandler*);
classHandler.h
<?php $x = $_GET['house_id']; ?>
<?php include 'connection.php';?>
<?php
$queryz = "SELECT * FROM photos WHERE id = $x";
$link = mysqli_query($conn, $queryz);
$lattitude = "SELECT latitude FROM location WHERE id=$x";
$lt = mysqli_query($conn,$lattitude) ;
$longitude = "SELECT longitude FROM location WHERE id=$x";
$lg = mysqli_query($conn,$longitude) ;
?>
<?php
include 'connection.php';
// Create connection
$queryz = "SELECT * FROM photos WHERE id = $x";
$link = mysqli_query($conn, $queryz);
$sql_1 = "SELECT * FROM house_info WHERE id = $x";
$result_1 = mysqli_query($conn,$sql_1);
$info = mysqli_fetch_array($result_1);
$city=$info['city'];
$type=$info['type'];
$location=$info['location'];
$landmark=$info['landmark'];
$gender=$info['gender'];
$address=$info['address'];
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="assets/js/jquery-2.1.0.min.js"></script>
<!--<link href="../../fonts/font-awesome.css" rel="stylesheet" type="text/css">-->
<!--<link href='http://fonts.googleapis.com/css?family=Roboto:700,400,300' rel='stylesheet' type='text/css'>-->
<!--<link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">-->
<!--<link href="../../css/style.css" rel="stylesheet" type="text/css">-->
<!-- bxSlider Javascript file -->
<script src="assets/js/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="assets/css/jquery.bxslider.css" rel="stylesheet" type="text/css" />
<style>
#map-simple { min-height: 240px; }
</style>
<title><?php echo $location;?></title>
</head>
<body class="external">
<div id="item-detail" class="content-container">
<div class="row">
<div class="col-md-8">
<div class="inner">
<!--<div class="items-switch">
<a href="#" class=""><img src="ourhousesassets/img/arrow-left.png"></a>
<a href="#" class=""><img src="ourhousesassets/img/arrow-right.png"></a>
</div>-->
<article class="animate move_from_bottom_short">
<div class="gallery">
<div class="image">
<ul class="bxslider">
<li><img height='100%' width='100%' src="addhouse/images_upload/1_1.jpg"/></li>
<li><img height='100%' width='100%' src="addhouse/images_upload/1_2.jpg"/></li>
<li><img height='100%' width='100%' src="addhouse/images_upload/1_3.jpg"/></li>
<li><img height='100%' width='100%' src="addhouse/images_upload/1_4.jpg"/></li>
</ul>
</div>
</div>
</article>
<article class="animate move_from_bottom_short">
<h1><?php echo $type;?>BHK Flat, <?php echo $location;?></h1>
<h2><i class="fa fa-map-marker"></i>Near <?php echo $landmark;?></h2>
<figure class="price average-color"><span><?php echo $gender;?></span></figure>
<figure class="price average-color"><span>Availability: <?php include './ourhousesassets/totalavailability.php';?></span></figure>
</article>
<!--end Description-->
<article class="sidebar">
<div class="person animate move_from_bottom_short">
<div class="inner average-color">
<!--<figure class="person-image">
<img src="ourhousesassets/img/person-01.jpg" alt="">
</figure>-->
<header>Address</header>
<a><?php echo $address;?></a><br>
<a>Near <?php echo $landmark;?></a>
<hr>
<a href="#person-detail" class="link" data-toggle="collapse" aria-expanded="false" aria-controls="person-detail"><b>Check Rents/Availability</b></a>
</div>
<?php include './ourhousesassets/getroomwiserent.php';?>
</div>
<!--end .person-->
<div class="block animate move_from_bottom_short">
<dl>
<dt>Bedrooms</dt>
<dd><?php echo $type;?></dd>
<dt>Locality</dt>
<dd><?php echo $location;?></dd>
<dt>Gender</dt>
<dd><?php echo $gender;?></dd>
</dl>
</div>
<div class="block animate move_from_bottom_short">
<dl>
<h2>Bills covered</h2><hr class="one">
<dt>Electricity</dt>
<dd><b><font color="#3fe173">✔</font></b></dd>
<dt>WiFi</dt>
<dd><b><font color="#3fe173">✔</font></b></dd>
<dt>DTH</dt>
<dd><b><font color="#3fe173">✔</font></b></dd>
<dt>Maintenance</dt>
<dd><b><font color="#3fe173">✔</font></b></dd>
<dt>Gas Connection</dt>
<dd><b><font color="#3fe173">✔</font></b></dd>
</dl>
</div>
</article>
<!--end Sidebar-->
<?php include './ourhousesassets/getfurniturelist.php';?>
<?php include './ourhousesassets/getapplianceslist.php';?>
<?php include './ourhousesassets/getamenitieslist.php';?>
<article>
<h3>Map</h3>
<div id="map-simple"></div>
</article>
</div>
</div>
<!--end .col-md-8-->
</div>
<!--end .row-->
</div>
<!--end #item-detail-->
<script type="text/javascript">
$(document).ready(function(){
$('.bxslider').bxSlider({
adaptiveHeight: true,
mode: 'fade'
});
});
</script>
<script>
var _latitude = <?php while($latt = mysqli_fetch_array($lt)){echo $latt['latitude'];}?>;
var _longitude = <?php while($lng = mysqli_fetch_array($lg)){echo $lng['longitude'];}?>;
var draggableMarker = false;
var scrollwheel = false;
var element = document.querySelector('body');
if( hasClass(element, 'external') ){
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "http://homigo.in/ourhousesassets/js/external.js";
head.appendChild(script);
}
else {
simpleMap(_latitude, _longitude,draggableMarker, scrollwheel);
rating();
averageColor( $('.content-container') );
}
function hasClass(element, cls) {
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
</script>
</body>
</html>
现在的目标是让C ++跟踪对象,所以我试图创建一个随后被调用的单例。查看代码的当前状态,我试图找出这是什么,因为我已经做了多次更改,试图修复链接器错误。
总的来说,我想知道这是否真的是一个链接错误或我的类实现的问题。我倾向于后者,但仍不确定如何解决问题。
我想要的设计再次如下:
实施:
Ada称C ++处理数据
C ++解析数据并将其存储在本地。
未实施:
Ada调用C ++来检索数据
C ++执行查找并返回数据数组。
任何帮助都会受到赞赏,因为我现在迷失在自己的代码中。谢谢!
EDIT1:
Ada代码过于强大,但我确信这一方面是正确的。至于编译器,我使用并发ANSI C / C ++编译器(PowerPC) - 5.4(005)。我不能改变编译器。前两个片段是代码的代理层。这就是Ada部分用于连接C ++代码的内容。