I got link error.Ecplise editor created the object file for that .cpp file.After compiling, object files and library files are linking.
at that time i got this error.
For Example, SGConfiguration.cpp ---------------> SGConfiguration.o
hello.cpp ------------------------------> hello.o
this is the full error
./SGConfiguration.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
This same program i complied successfully in Netbeans.
actually i dont have any idea of netbeans or eclipse... how they work or compile the source..
i just saw you are working on windows.. otherwise you could have used autoconf and automake to create makefiles on linux/unix for large number of files.. thats a very easy process.. but i dont know if automake work on windows..leave this..
which platform you compile your code with netbeans??
on windows it is easy to use visual studio but i dont know if you have visual studio?
#add include paths for any other header files with -I switch
INCLUDES =
1 2 3 4 5 6 7 8 9
//main.cpp
#include <stdio.h>
#include "add.h"
int main()
{
int retval = add(10, 20);
return 0;
}
1 2 3 4 5 6 7
//add.cpp
#include "add.h"
int add(int x, int y)
{
return (x + y);
}
1 2 3 4 5 6 7
//add.h
#ifndef __add_h__
#define __add_h_
int add(int x, int y);
#endif
thats it.. you are dont..
cd ..
aclocal
autoconf --add-missing
automake
./configure //this will create your makefile
make //this will create a binary with name "add"
thats all you need to do.. now if you add any new file to project, just add it to Makefile.am and aclocal to make again.
if autoconf or automake give error for any missing files, create these file using touch. it may give error for INSTALL, COPYING, README, NEWS, depcomp, AUTHORS etc etc.. so create these files manually.