im getting an error and I dont know why can anyone help.
this is the error...... - /tmp/ccxaenRY.o(.text+0x375): In function `main':
-
: undefined reference to `average_quizes(records, float&)'
-
collect2: ld returned 1 exit status
7 3644
im getting an error and I dont know why can anyone help.
this is the error...... - /tmp/ccxaenRY.o(.text+0x375): In function `main':
-
: undefined reference to `average_quizes(records, float&)'
-
collect2: ld returned 1 exit status
I think it is because your prototype is different from your declareation: - void average_quizes(records,float&);
-
void average_quizes(records* obj,float& quiz_average)
You ask for a pointer in one and an actual object in the other.
You can overload a function by the type of arguements are passed to it. So the compiler sees the function, but doesn't see the actual body. The one you gave it is not looked for because it takes a pointer. Try changing one of them and see what happens.
i changed that and now I got this
test.cpp: In function `int main()':
test.cpp:63: error: cannot convert `records' to `records*' for argument `1' to `void average_quizes( records*, float&)'
i changed that and now I got this
test.cpp: In function `int main()':
test.cpp:63: error: cannot convert `records' to `records*' for argument `1' to `void average_quizes( records*, float&)'
Ok, that means you are passing a "records" when you should pass a pointer to one. You can either pass a pointer or change the function to take an actual object instead of a pointer.
I thought I was passing a pointer. What did I do wrong
I thought I was passing a pointer. What did I do wrong
You weren't passing a pointer. Add an ampersand in front of the variable or make it a pointer. Do you know how to do that?
do u mean something like this
void get_score(recor ds&,float&)
but that would pass it by reference.
how would I make it a pointer?
do u mean something like this
void get_score(recor ds&,float&)
but that would pass it by reference.
how would I make it a pointer?
No, no. The way you are calling the function is the problem. You are passing in an object of "records" type. You need a pointer to the location of that object. To do that add an ampersand in front of the variable grades in your function call.
Like this: -
average_quizes(&grades, quiz_average);
-
Post here if you are having problems.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: skubik |
last post by:
Anyone else have this problem compiling PHP 4.3.3 from source under Linux
(I'm using Slackware 9.0)?
Under PHP 4.3.2 I had no compilation problems at all, but now all of the
sudden, compiling with GD support gives me the list of errors below.
My ./configure is:
../configure --with-pgsql=/usr/local/pgsql --with-ssl=/usr/local/ssl
--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib-dir=/usr/lib
|
by: RU |
last post by:
Hi,
I am working on a porting project to port C/C++ application from
unixware C++, AT&T Standard components to g++ with STL on Linux. This
application has been working properly on Unixware/C++/AT&T componets
environment.
I have been able to compile all modules after making necessary changes
in LINUX/gcc/STL environment. We have two templates defined XList and
XMap.
|
by: Hardy |
last post by:
Hi, just come into the boost world. just the first.cpp in the
program_options examples, with many link error...
devc++4.9.9.2, gcc 3.4.2,
can I get your opinions on this problem? thank you~
make.exe -f "D:\temp\Makefile.win" all
g++.exe -c main.cpp
-o
|
by: Jean-Christian Imbeault |
last post by:
On my RH 9.0 linux system when ./configuring 7.3.4 I get an error about
not finding the readline libs, however both the readline and
readline-devel rpms are installed:
# rpm -qa | grep readline
readline-4.3-5
readline-devel-4.3-5
What library/rpm am I missing?
|
by: Robert Fitzpatrick |
last post by:
I am getting the following problem with trying to install from source
PHP 4.3.6 with PG support on FreeBSD 5.2.1. I have PostgreSQL 7.4.2
recently upgraded from 7.3.x and it is up and running fine. I also have
Heimdal 0.6 installed and PostgreSQL was built with that support. Is the
error below from something missing on the Heimdal side of things or
PostgreSQL? And what does anyone suggest to resolve the issue? Maybe I
need to rebuild...
| |
by: yogesh |
last post by:
mysql in c++ initialize error occurs a simple program is executed in
redhat9.0 , using gcc 3.2.2 compiler version ...
#include <stdio.h>
#include <mysql.h>
#include <string.h>
int main()
{
|
by: sublimanized |
last post by:
Hello all ... here is my problem. I just got the book "Teach Yourself C
++ in 21 Days"
Setup:
Fedora Core 6 - i386
GCC 4.1.1
Again, I am a complete newcomer to C++, and this is one of the first
examples out of the book. I want to know why exactly this doesn't
clean compile, and how would i fix it?
|
by: prakash.mirji |
last post by:
Hello,
I am getting below mention linker error when I tried to link my class
test.C
I use below command to compile test.C
/usr/bin/g++ -g -fpic -fvisibility=default -D_POSIX_SOURCE -DTRACING -
D__EXTENSIONS__ -D__RWCOMPILER_H__ -D_REENTRANT -D_RWCONFIG=8s -
D_RWCONFIG_12d -D_RWSTDDEBUG -DRWDEBUG -o test1 test1.o -L/lib -
|
by: Benjamin Grieshaber |
last post by:
Hi,
I´m on SuSE 9.3 with xmlrpc-c and xmlrpc-c-devel installed (ver. 0.9.10)
I tried to compile php with xmlrpc support and got the following errors:
ext/xmlrpc/.libs/xmlrpc-epi-php.o(.text+0x359): In function
`set_zval_xmlrpc_type':
/php-5.2.5/ext/xmlrpc/xmlrpc-epi-php.c:1313: undefined reference to
`XMLRPC_CreateValueDateTime_ISO8601'
|
by: singhPrabhat |
last post by:
I have some .c and .h files in my directory. My aim is to compile the whole file. I am compiling each and every .c file by
gcc -c file_name then I use gcc -o some_text file_name.
I have found out that some file starts with #ifdef UNIX. But UNIX is nowhere defined in either header file(.h file) it includes not in the file itself.
For the time being I am defining as #include UNIX in the file whereever required.
some of the files...
|
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...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |