I'm not new to programming, but I am fairly new to C++. I've got a bit of a
problem with a project that I am working on. My environment is as follows:
OS: Mandrake 10
IDE: Anjuta
Compiler: gnu
The project I am working on is a C/C++ combo. I've created a class (in C++)
to encapsulate a particular bit of functionality; this class makes calls to
some C functions in a separate file (nothing complicated). All of the
necessary includes are in place.
The problem is this: when I "Compile" my file, it works fine and produces no
errors, but when I go to "Build" my file I get errors in the file that I
just compiled with no errors. The errors read "undefined reference to
function_name_here(param1*, param2)". The errors are produced on each line
that makes a call to a function in the C file.
I'm a little confused as to what I need to do here. Why does it compile but
not build?
Thanks.
-Sheppe 7 1336
Noone wrote: I'm not new to programming, but I am fairly new to C++. I've got a bit of a problem with a project that I am working on. My environment is as follows:
OS: Mandrake 10 IDE: Anjuta Compiler: gnu
The project I am working on is a C/C++ combo. I've created a class (in C++) to encapsulate a particular bit of functionality; this class makes calls to some C functions in a separate file (nothing complicated). All of the necessary includes are in place.
The problem is this: when I "Compile" my file, it works fine and produces no errors, but when I go to "Build" my file I get errors in the file that I just compiled with no errors. The errors read "undefined reference to function_name_here(param1*, param2)". The errors are produced on each line that makes a call to a function in the C file.
See the FAQ (particularly item 32): http://www.parashift.com/c++-faq-lite
Denis
Noone wrote: [...] I'm a little confused as to what I need to do here. Why does it compile but not build?
Get a decent book on gnu tools. You probably forget that for linking
you need to supply all object modules in the same command line.
BTW, compiler command lines are off-topic here. Please refer to
newsgroups comp.os.linux.development.* and gnu.g++.help for further
information.
V
"Noone" <no***@nowhere.com> wrote in message
news:SuLWc.208928$gE.115676@pd7tw3no... I'm not new to programming, but I am fairly new to C++. I've got a bit of
a problem with a project that I am working on. My environment is as follows:
OS: Mandrake 10 IDE: Anjuta Compiler: gnu
The project I am working on is a C/C++ combo. I've created a class (in
C++) to encapsulate a particular bit of functionality; this class makes calls
to some C functions in a separate file (nothing complicated). All of the necessary includes are in place.
The problem is this: when I "Compile" my file, it works fine and produces
no errors, but when I go to "Build" my file I get errors in the file that I just compiled with no errors. The errors read "undefined reference to function_name_here(param1*, param2)". The errors are produced on each line that makes a call to a function in the C file.
I'm a little confused as to what I need to do here. Why does it compile
but not build?
Look up "extern C". If that doesn't help, try creating
a small example that produces the problem and post it here
(standard code only, please).
-Mike
Thanks for the link. :)
-Sheppe
"Denis Remezov" <fi***************@yahoo.removethis.ca> wrote in message
news:41***************@yahoo.removethis.ca... Noone wrote: I'm not new to programming, but I am fairly new to C++. I've got a bit
of a problem with a project that I am working on. My environment is as
follows: OS: Mandrake 10 IDE: Anjuta Compiler: gnu
The project I am working on is a C/C++ combo. I've created a class (in
C++) to encapsulate a particular bit of functionality; this class makes calls
to some C functions in a separate file (nothing complicated). All of the necessary includes are in place.
The problem is this: when I "Compile" my file, it works fine and
produces no errors, but when I go to "Build" my file I get errors in the file that I just compiled with no errors. The errors read "undefined reference to function_name_here(param1*, param2)". The errors are produced on each
line that makes a call to a function in the C file.
See the FAQ (particularly item 32): http://www.parashift.com/c++-faq-lite
Denis
On Tue, 24 Aug 2004 18:08:50 GMT in comp.lang.c++, "Noone"
<no***@nowhere.com> wrote, just compiled with no errors. The errors read "undefined reference to function_name_here(param1*, param2)". The errors are produced on each line that makes a call to a function in the C file.
Are you sure that you declared the function with
extern "C"
in the C++ part?
This issue is covered in Marshall Cline's C++ FAQ. See section
"[32] How to mix C and C++" It is always good to check the FAQ before
posting. You can get the FAQ at: http://www.parashift.com/c++-faq-lite/
Awesome! That fixed me up. Thanks for the tip. :)
-Sheppe
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:bI*******************@newsread1.news.pas.eart hlink.net... "Noone" <no***@nowhere.com> wrote in message news:SuLWc.208928$gE.115676@pd7tw3no... I'm not new to programming, but I am fairly new to C++. I've got a bit
of a problem with a project that I am working on. My environment is as
follows: OS: Mandrake 10 IDE: Anjuta Compiler: gnu
The project I am working on is a C/C++ combo. I've created a class (in C++) to encapsulate a particular bit of functionality; this class makes calls to some C functions in a separate file (nothing complicated). All of the necessary includes are in place.
The problem is this: when I "Compile" my file, it works fine and
produces no errors, but when I go to "Build" my file I get errors in the file that I just compiled with no errors. The errors read "undefined reference to function_name_here(param1*, param2)". The errors are produced on each
line that makes a call to a function in the C file.
I'm a little confused as to what I need to do here. Why does it compile but not build?
Look up "extern C". If that doesn't help, try creating a small example that produces the problem and post it here (standard code only, please).
-Mike
As I replied to Mr. Wahler, doing this fixed things right up for me. Thanks!
:)
-Sheppe
"David Harmon" <so****@netcom.com.invalid> wrote in message
news:41**************@news.east.earthlink.net... On Tue, 24 Aug 2004 18:08:50 GMT in comp.lang.c++, "Noone" <no***@nowhere.com> wrote,just compiled with no errors. The errors read "undefined reference to function_name_here(param1*, param2)". The errors are produced on each
linethat makes a call to a function in the C file.
Are you sure that you declared the function with extern "C" in the C++ part?
This issue is covered in Marshall Cline's C++ FAQ. See section "[32] How to mix C and C++" It is always good to check the FAQ before posting. You can get the FAQ at: http://www.parashift.com/c++-faq-lite/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Hollingsworth |
last post by:
Hello,
Very new to python, so a noob question. When I've written stuff in
JavaScript or MEL in the past, I've always adopted the variable naming
convention of using a $ as the first character...
|
by: Olumide |
last post by:
In the following C++ class,
MyClass{
// Members
}
From which I create two objects (using the default constructor),
(1) MyClass *object1 = new MyClass(); // Stack
(2) MyClass object2 =...
|
by: Ivan Shevanski |
last post by:
Alright heres another noob question for everyone. Alright, say I have a
menu like this.
print "1. . .Start"
print "2. . .End"
choice1 = raw_input("> ")
and then I had this to determine what...
|
by: cgough |
last post by:
My true programming language is C++. I am at best a VB6 hacker that is
just getting into VB.NET. I have a quick question about when to new and
when not to new.
Consider the following 2 classes....
|
by: Holger |
last post by:
Hi guys
Tried searching for a solution to this, but the error message is so
generic, that I could not get any meaningfull results.
Anyways - errormessage:...
| |
by: streamkid |
last post by:
i'm a learning newbie at c++... and i have the following question...
reading some source code, i saw this:
int function(const void * one, const void * two)
{
int var1, var2;
var1 =...
|
by: jobs |
last post by:
Three noob questions. Please help.
1. Is there a way to have arguments on subroutine that are optional?
2. Say I need to convert datetime to string..in this format :
2006-09-07...
|
by: azz131 |
last post by:
Hi, i want to access an array of objects inside a method like this
using System;
using System.Collections.Generic;
namespace ObjectArray
{
class MainClass{
class MyClass
|
by: * Tong * |
last post by:
Hi,
I couldn't figure out how to properly type cast in this case:
$ cat -n type_cast.c
1 #include <stdio.h>
2
3 typedef unsigned char Byte;
4 typedef signed char Small_Int;
5
|
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,...
|
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...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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...
|
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 ...
| |
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...
| |