Programming :: Undefined Reference To 'main' Error In Crt1.o Function _start

Apr 13, 2011

I've having problems with my Makefile.

I'm trying to create a program from 2 files - main.cpp that contains the main function, and modules.c that contains the definitions of the functions that are called in main(). modules.c only contain function definitions, no main function.

My Makefile is as follows:


I have included "modules.h", which contains all the function declarations, in my main.cpp.

When I try to make using this Makefile, I get the error


If I switch the order of modules.o and main.o in my $(TARGET) line, then I get errors that say "undefined reference to" the functions I have defined in modules.c, in main.cpp.

View 4 Replies


Programming :: Undefined Reference To - Function Error

Nov 11, 2010

I have been trying to build a file called main.cpp through my make file which is in Linux.

There are functions like

Which are being called. I have included all the necessary headers and also have included the necessary lib.a files in the make file as below:

I am still getting the below error. I use make -j makefile.mak clean all command to make the build.

View 1 Replies View Related

Programming :: Undefined Reference To 'main'?

Jun 22, 2010

When I try to compile my code using g95 or gfortran:

subroutine dipole_tilt(glong, glat, utsec, tau, day, hgraze)
implicit none


View 4 Replies View Related

Programming :: Undefined Reference To Function ?

Jun 21, 2011

I'm using Linux and I have the following files:

The function F1() is declared in fileB.h and defined in fileB.cpp. I need to use the function in fileA.c, and so I declared the function as

However, during compilation, I got the error fileA.c: (.text+0x2b7): undefined reference to `F1'

View 2 Replies View Related

Programming :: Getting Undefined Reference To Main In Sub-class For BST?

Apr 27, 2011

I'm writing a binary search tree class to insert records and I'm stuck on the following error:

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
Here is the code for my class:


I really don't know how to approach this, I thought that everything was working fine but I have no idea what is wrong. Also, for clarification, main() is in a different .cpp file that #includes "tree.h"

View 13 Replies View Related

General :: Error - Undefined Reference To Main ?

Feb 14, 2010

I keep getting the error:

Here is my code:

View 2 Replies View Related

Programming :: Undefined Reference To Function While Linking

May 27, 2010

I am trying to add some function to the c++ project (calling function) and the called function are in C. And i am getting error "undefined reference to "Hello(int,int)" " while linking. It is compiling correctly. It is linking to header file mention in the calling function. This header file has definition to the c - called function. Do you thinking having c files into C++ project will be a problem? Should I remove <stdio.h> in c files?

View 2 Replies View Related

OpenSUSE :: Compiling Java Code Error "undefined Reference To Main"

Aug 9, 2011

After messing up with grub, I reformatted my hdd and installed opensuse 11.4 (gnome+kde) from the dvd and also included the java sdk while installing, now the problem is that whenever i compile a java program, I get this error Code: /usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'

View 3 Replies View Related

Programming :: Undefined Reference Error When Using Lua API?

Jul 20, 2011

I wrote a small test program, and this is what happens when I try to compile it:

$ g++ -llua main.cpp
/tmp/ccHJ8HR3.o: In function `main':


View 8 Replies View Related

Programming :: C Program - Undefined Reference Error ?

Jul 21, 2010

I'm building my main program on SUSE using C, but the compiler returns the error below.


Here's my code to which the errors are pointing to:


View 3 Replies View Related

Programming :: Getting Undefined Reference Error When Try To Install NOX

Jul 12, 2010

I am trying to install NOX which is a openflow controller and it needs Xerces-C++ this. I installed it successfully on the Debian. The output of the xerces after running the "make install" command is as follows which shows that is successfully installed on the machine.


View 17 Replies View Related

Software :: Debug Undefined Reference To Library Function (yad 0.5.1)?

Oct 15, 2010

I'd like to learn debugging techniques as much as to solve this particular problem. While trying to build yad 0.5.1:


yad-notification.o: In function `yad_notification_run':
/tmp/yad-0.5.1/src/notification.c:330: undefined reference to `gtk_status_icon_set_tooltip_text'

According to the source package's README file, "Yad depends on gtk+ only. Minimal gtk+ version is 2.12.0". I checked /var/log/packages and found gtk+2-2.14.7-i486-4 is installed.

Inspecting /tmp/yad-0.5.1/src/notification.c showed that gtk_status_icon_set_tooltip_text is a function. So it should be declared in the gtk+2-2.14.7 header files (or not?).



c@CW8:/usr/include/gtk-2.0$ find . -name '*.h' -exec grep gtk_status_icon_set_tooltip_text {} ;
[no output]

Is this enough analysis to justify reporting an issue? Is there any more I can do before logging an issue?

OS: Slackware 13.0 32-bit.
yad download:

The downloaded package checksums OK. Netsearching for gtk_status_icon_set_tooltip_text finds no pages.

View 3 Replies View Related

Programming :: PHP Fatal Error - Call To Undefined Function Mysql_connect()

Nov 5, 2010

Am getting errors about "mysql_connect()" for the following code:

Have compiled PHP with MySQL support using the following:

Thought PHP 5.3 has a built-in replacement called mysqlnd, and there's no need to install "php-mysql" RPM.

However, according to the following site this is still required: [url]

Give me an idea whether I really have to install php-mysql RPM in order to use mysql_connect() for PHP?

View 4 Replies View Related

Programming :: Typical Error "undefined Reference To Clock_gettime"

Oct 14, 2010

I am slowly getting accustomed with linux issues and its different programming compilation stuffs. and i must say am truly liking it. Now i am facing this typical error , "undefined reference to `clock_gettime'" while i am compiling a code, which is not mine as it required to install a simulator. Now i have read about this type for the last 2 days and i have included "-lrt" in the make file and included <time.h> in the header files which was missing but still i am getting that error.

Now matter how many times i run the make file with the required changes its still giving me this error, which i have comprehended as mainly linking problem rather than a compilation issue.

View 4 Replies View Related

Programming :: Linker Error "undefined Reference" With G++

Jul 30, 2010

I am facing some problems when i am trying to link using g++. The linker error text is "undefined reference to `std::vector<std::string, std::allocator<std::string> >::end()'"

View 3 Replies View Related

Programming :: Gcc Returning Undefined Reference?

Jun 23, 2010

I am facing the problem of calling cfitsio library from C program in linux. when i am givingthe option "gcc -o CreateLevel1DataFitsFile CreateLevel1DataFitsFile.c -lm -lcfitsio
"i am getting following error

/usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(getcolj.o)(.text+0x7065):/backup/Astrosat/learning/cfits/cfitsio/getcolj.c:3098: more undefined references to `__xtoll' follow


View 2 Replies View Related

Programming :: Undefined Reference To `stricmp'

Dec 10, 2010


#include <string.h>
int main ()
stricmp ("anisha", "kaul");
return 0;



View 14 Replies View Related

Programming :: Undefined Reference To `__isoc99_sscanf'

Apr 5, 2011

When I compile my code in Linux (ATCA machine), I am getting the following error: /vobs/ims_do/lib/rhlinux/debug/ undefined reference to `__isoc99_sscanf'

The same code is being compiled in Solaris without any problems.

View 2 Replies View Related

Programming :: Undefined Reference To `getdata(StudentInfo&)'?

Sep 19, 2010

I'm new to C++ programing and also new to gcc compiler.

View 1 Replies View Related

Programming :: Undefined Reference To 'vtable For WxHyperlinkCtrl'?

May 11, 2011

Do you have any ideas why does wxHyperlinkCtrl doesn't work on Linux?It has an error which says..."/usr/include/wx-2.8/wx/gdicmn.h:215: undefined reference to 'vtable for wxHyperlinkCtrl'"Do I have to include a certain library so that it will work in Linux? I try to compile it in windows and its succesful.'m having a problem on Linux guysinitialize the wxHyperlinkCtrl like this... wxHyperlinkCtrl* hyperlink1 = new wxHyperlinkCtrl();and included #include <wx/hyperlink.h> Is there something missing on it?... I already had tried supplying parameters on the constructor but same thing it gives me an error

View 1 Replies View Related

Programming :: Undefined Reference To 'pthread_create' From Linker?

Jul 6, 2010

I am having trouble linking the pthread library.I have -lpthread -lm as options for the GNU GCC compiler.

Build Log
Compiling: main.c
Compiling: matrix.c


View 2 Replies View Related

Software :: Gcc Does Not Show Undefined Reference Error?

Jul 25, 2010

When the following little C program is compiled with gcc it does not get a compile error even though the function atof is undefined. If I change it to xatof then it goes get an "undefined reference" error. (I knowthat atof is a library function, and I know that it resides in stdlib.h But since I did not include stdlib.h I would think that it would give me an error). What am I missing here?

double f;


View 8 Replies View Related

Programming :: Parse A File Using Html Parser By Libxml - Undefined Reference

Jan 13, 2011

iḿ trying to parse a file using html parser by libxml.

Code: #include <stdio.h>
#include <libxml/HTMLparser.h>
#include <string.h>
void main(){

View 4 Replies View Related

Programming :: (.text+0x7): Undefined Reference - Compiling Program Include One Header File And 2 C

May 21, 2011

i am a new programer in c i have write a simple app and i have a problem with combiling my program include one header file and 2 c

void f();
void f(){

View 6 Replies View Related

Programming :: Linking Object Files With Geany On Ubuntu - Undefined Reference To Class::functionName

Mar 9, 2009

I have created a simple test class - Mortgage, with the class declaration in the .h file and the class's methods defined in the .cpp file. (mortgage.h && mortgage.cpp, respectively) Straight up C++ 101 as far as I can tell. I instantiate the class in the main() function, which is defined in practice.cpp. Using Geany on Ubuntu, both the practice.o and mortgage.o files are created, but then I get a linker error: undefined reference to class::functionName

I get it for each function. If the mortgage.cpp file is foremost in the editor when I click "build", then I get the undefined reference to main() error, if practice.cpp is foremost (where the main() function is) then I get undefined reference to Mortgage::Mortgage(), and all the rest of the functions defined for that class. How do I get the linker to know where my object files are so it will link them in? Or is the problem somewhere else entirely?

View 8 Replies View Related

Programming :: Bash Array Add Function Example Using Indirect Array Reference As Function Argument?

Jun 20, 2010

I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.

local arrayname=$1


View 10 Replies View Related

Programming :: Link The MySQL Libraries To Some C Code - /home/zgp/gammasqla/list.c:1883: Undefined Reference To `db_do_query'

Sep 6, 2010

I'm trying to link the MySQL libraries to some C code, the LambdaMOO server to be exact. I'm getting the following error:

gcc -g -O -L/usr/lib/mysql -lmysqld -I/usr/include/mysql ast.o code_gen.o db_lo
ad.o db_flush.o db_objects.o db_properties.o db_verbs.o decompile.o disassemble.
o eval_env.o eval_vm.o exceptions.o execute.o extensions.o functions.o keywords.


You can see the link commands I'm using, and the lib and include path are both valid. I tried replacing -lmysqld with -lmysqlclient but this did not help. I'm using Debian and MySQL, libmysqld-dev and libmysqlclient-dev are all installed.

View 1 Replies View Related

Programming :: Undefined Symbols When Linking A With Main O Files

Feb 17, 2010

I am using Centos 5.4 with gcc v4.1.2. If I take a bunch of .o files and I then link with my main.o to form an executable then this links and executes just fine. If however, I try to create an archive file (.a) using 'ar rus xxx.o yyy.o etc' and then try to link the resulting .a with my main.o then I get 'undefined symbol' linker errors and I don't understand why.

View 2 Replies View Related

Programming :: Memory Allocate In Function And Call It By Reference For Array Structure?

Jul 2, 2011

I am writing a function(in C language in Linux) to initialize an array of a structure from a mysql table by calling a function by reference but I have a problem with call this function by reference . this is my program:PHP Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


View 4 Replies View Related

Server :: Fatal Error: Call To Undefined Function

May 7, 2010

I had created a database in mysql called guestbook and created tables also in mysql and also granted remote connections privileges from below command

mysql> grant all privileges on *.* to root@ identified by "rrcrrc";

i had accessed from my pc( and used phprunner to create php web pages and copied the phprunner output folder to use with apache. when i accessed from my pc the below error is coming

Fatal error: Call to undefined function: mysql_connect() in /home/administrator/useridall/include/dbconnection.php on line 9

i can't understand what is going on so i put this question in the forum, below is i am giving the dbconnection.php details.

function db_connect()


View 3 Replies View Related

Copyrights 2005-15, All rights reserved