c项目由许多类和文件组成。 C ++库被编译为“ .a”文件。当我将.a文件作为库添加到C项目的MakeFile中时,它显示出许多类似undefined reference to '__gxx_personality_v0'
的错误,可能与C和C ++之间的差异有关。
我正在使用gcc编译C项目。但是我在C项目中调用的任何函数在C ++库的头文件中都声明为extern C
。
非常感谢您的帮助!
答案 0 :(得分:3)
您必须使用C ++链接程序,或将<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="quiz" content="myown quiz">
<title>Quiz</title>
</head>
<body>
<script type="text/javascript" src="machine.js"></script>
<link rel="stylesheet" type="text/css" href="quizformatting.css">
<h1>Choose the major right for you</h1>
<pre>
<form>
Do you like enjoy programming?
<select>
<option class="choice">Select a value</option>
<option class="program">Yes</option>
<option class="no">No</option>
</select>
Do you enjoy 2d animation and 3d animation?
<select>
<option class="choice">Select a value</option>
<option class="art">Yes</option>
<option class="no">no</option>
</select>
Do you like music
<select>
<option class="choice">Select a value</option>
<option>Yes</option>
<option class="no">no</option>
</select>
What are your favorite pastimes?
<select>
<option class="choice">Select a value</option>
<option class="music">Listening to music</option>
<option>making websites</option>
<option class="art">Drawing</option>
<option class="no">None of these</option>
</select>
Out of all the activities you like to do, which one do you enjoy the most?
<select>
<option class="choice">Select a value</option>
<option class="art">Painting and drawing</option>
<option class="music">Playing instruments</option>
<option class="art">Drawing</option>
<option class="no">None of these</option>
</select>
Would you be interested in making art or coding for video games?
<select>
<option class="choice">Select a value</option>
<option class="program">I would be interested in learning the programming
languages used to create the scripting for games</option>
<option class="art">I would like to the models and the environment for
modeling</option>
<option class="no">I'm not interested in either of these options</option>
</select>
Do you enjoy making websites or learning how to sing?
<select>
<option class="choice">Select a value</option>
<option class="music">Learning how to sing</option>
<option class="program">making websites for projects</option>
<option class="no">I'm not interested in any of this</option>
</select>
Do you enjoy listening to music more or making programming applications?
<select>
<option class="choice">Select a value</option>
<option class="music">I would like to listen to music</option>
<option class="program">Programming is my thing</option>
<option class="art">I'm more of a drawer</option>
<option class="no">I don't like any of these options</option>
</select>
Which skillset are you more interested in learning?
<select>
<option class="choice">Select a value</option>
<option class="music">Learning the notes of instruments</option>
<option class="program">Learning the language of javascript</option>
<option class="art">I like anime, so I would love to learn how to animate in
anime style</option>
<option class="no">I don't want to do any of these options</option>
</select>
Please press the button to get your answer
<button onclick="Starting(event);">Click me</button>
</form>
</pre>
</body>
</html>
Here is my javascript file:
用作链接驱动程序而不是g++
。
问题在于基本链接器不会针对C ++运行时库进行链接(对于Fortran静态库也是如此)。用于编译器的C ++驱动程序将为您添加这些标志。