473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

New to C, "Undefined reference's"

Hi, I am trying to compile a sample program using gcc. The program
requires headers so I put the header files and corresponding source
files into one folder. Then I ran the command 'gcc prog.c -o
prog.exe.' It then gives me errors such as "undefined reference to
'_N_VNew'" where N_VNew is in the header files I put in the folder.
Usually gcc file.c -o file.exe worked for a c program that include no
user defined headers. I've never dealt with headers before, is there
some gcc command I need to use? btw, I doubt there is a problem in the
source code calling the headers.

Thank You
Dec 2 '07 #1
4 1682
steve said:
Hi, I am trying to compile a sample program using gcc. The program
requires headers so I put the header files and corresponding source
files into one folder. Then I ran the command 'gcc prog.c -o
prog.exe.' It then gives me errors such as "undefined reference to
'_N_VNew'" where N_VNew is in the header files I put in the folder.
Usually gcc file.c -o file.exe worked for a c program that include no
user defined headers. I've never dealt with headers before, is there
some gcc command I need to use? btw, I doubt there is a problem in the
source code calling the headers.
You have asked question 13.25 in the comp.lang.c FAQ, which can be found at
http://c-faq.com/

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Dec 2 '07 #2
Can someone give me an example, for instance, if I declare #include
"aheader.h" in my program and aheader.h is in the same folder of
myprog.c. I am in windows so I want to essentially run gcc myprog.c -o
myprog.exe to make an exe file.

Thank You
Dec 2 '07 #3
steve said:
Can someone give me an example, for instance, if I declare #include
"aheader.h" in my program and aheader.h is in the same folder of
myprog.c. I am in windows so I want to essentially run gcc myprog.c -o
myprog.exe to make an exe file.
This is not a header issue, as the FAQ I told you about should have made
abundantly clear to you. "Undefined reference" generally means you've
forgotten to link a library (although that is not the only possible cause
of that message, it would seem to be the cause in this case, from what
you've said so far).

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Dec 2 '07 #4
steve wrote:
Hi, I am trying to compile a sample program using gcc. The program
requires headers so I put the header files and corresponding source
files into one folder. Then I ran the command 'gcc prog.c -o
prog.exe.' It then gives me errors such as "undefined reference to
'_N_VNew'" where N_VNew is in the header files I put in the folder.
The header only contains the declaration of that type. The definition is
in some library. There's a FAQ which is relevant to this.

By the way, you have a Greengrocer's apostrophe in your subject. Plurals
do not generally require apostrophes.
Dec 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steven T. Hatton | last post by:
Scroll to the bottom and read the last part first. I've been trying very diligently to 'modularize' the code from TC++PL3E found here: http://www.research.att.com/~bs/matrix.c I keep getting...
13
by: Don Vaillancourt | last post by:
What's going on with Javascript. At the beginning there was the "undefined" value which represented an object which really didn't exist then came the null keyword. But yesterday I stumbled...
4
by: Flip | last post by:
I'm seeing one of my websites giving me an error message on the page after it loads up as "WXBUnit Undefined" What does that mean? The formatting of the site is horrible! I'm not sure what is...
49
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On...
9
by: Klaus Johannes Rusch | last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of an unknown property of an object, for example document.write(typeof window.missingproperty); Has "unknown" been defined...
5
by: Jason | last post by:
Hello, I am trying to dynamically create a table, then set its <td>'s onclick: var table = document.createElement("table"); var row = table.insertRow(-1); var td = row.insertCell(-1);...
3
by: s.z.s | last post by:
Hi! I hope the solution to that is not too stupid... I've got three files: <snip test_main.cc> #include"test.hh" int main(void) { A<inta1; a1.saywhat();
15
by: bill | last post by:
I am trying to write clean code but keep having trouble deciding when to quote an array index and when not to. sometimes when I quote an array index inside of double quotes I get an error about...
8
by: Soneji | last post by:
Hello all! ( again ) Once more, I have a problem that seems unsolvable by me. I'm getting the, seemingly common, "undefined reference" linking error. I've tried quite a few things, but...
8
Motoma
by: Motoma | last post by:
Good evening everyone. I am starting to re-explore C++, and I wanted to build a singleton class. Unfortunately, when I set things up as I do in PHP, it doesn't work out for me. I hope that the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.