Results 1 to 8 of 8
i am using ubuntu 8.4
net beans 6.5 IDE
my c code is
#include "stdio.h"
main()
{
printf("hello\n");
return 0;
}
when i try to run it it gives me ...
- 01-21-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 7
Complilation error
i am using ubuntu 8.4
net beans 6.5 IDE
my c code is
#include "stdio.h"
main()
{
printf("hello\n");
return 0;
}
when i try to run it it gives me the following error message
i have set project property->c compiler>include directory
to a dir containing stdio.h file which i've downloaded from
http://www.koders.com/c/fidBA34B16D0...nload+unistd.h
while in the other m/c with same configuration i get following message
Running "/usr/bin/make -f Makefile CONF=Debug" in /home/npadharia/NetBeansProjects/Application_1
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/npadharia/NetBeansProjects/Application_1'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/application_1
make[2]: Entering directory `/home/npadharia/NetBeansProjects/Application_1'
mkdir -p dist/Debug/GNU-Linux-x86
gcc -o dist/Debug/GNU-Linux-x86/application_1 build/Debug/GNU-Linux-x86/prac.o
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/application_1] Error 1
make[2]: Leaving directory `/home/npadharia/NetBeansProjects/Application_1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/npadharia/NetBeansProjects/Application_1'
make: *** [.build-impl] Error 2
Build failed. Exit value 2.
Running "/usr/bin/make -f Makefile CONF=Debug" in /home/jjoshi/NetBeansProjects/hi
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/jjoshi/NetBeansProjects/hi'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/hi
make[2]: Entering directory `/home/jjoshi/NetBeansProjects/hi'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/hi.o.d
gcc -c -g -I../../Desktop/c\ lib -MMD -MP -MF build/Debug/GNU-Linux-x86/hi.o.d -o build/Debug/GNU-Linux-x86/hi.o hi.c
In file included from hi.c:2:
../../Desktop/c lib/stdio.h:46:27: warning: crtdll/stddef.h: No such file or directory
In file included from hi.c:2:
../../Desktop/c lib/stdio.h:176: error: expected declaration specifiers or ... before size_t
../../Desktop/c lib/stdio.h:198: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:212: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:213: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:214: error: expected ) before * token
../../Desktop/c lib/stdio.h:215: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:216: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:217: error: expected ) before * token
../../Desktop/c lib/stdio.h:228: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:229: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:230: error: expected ;, , or ) before * token
../../Desktop/c lib/stdio.h:250: error: expected =, ,, ;, asm or __attribute__ before fgetwc
../../Desktop/c lib/stdio.h:251: error: expected =, ,, ;, asm or __attribute__ before fputwc
../../Desktop/c lib/stdio.h:252: error: expected =, ,, ;, asm or __attribute__ before getwc
../../Desktop/c lib/stdio.h:253: error: expected =, ,, ;, asm or __attribute__ before ungetwc
../../Desktop/c lib/stdio.h:255: error: expected =, ,, ;, asm or __attribute__ before _filwbuf
../../Desktop/c lib/stdio.h:256: error: expected =, ,, ;, asm or __attribute__ before _flswbuf
../../Desktop/c lib/stdio.h:278: error: expected =, ,, ;, asm or __attribute__ before fread
../../Desktop/c lib/stdio.h:280: error: expected =, ,, ;, asm or __attribute__ before fwrite
make[2]: *** [build/Debug/GNU-Linux-x86/hi.o] Error 1
make[2]: Leaving directory `/home/jjoshi/NetBeansProjects/hi'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/jjoshi/NetBeansProjects/hi'
make: *** [.build-impl] Error 2
Build failed. Exit value 2.
- 01-21-2009 #2
install package build-essential using synaptic or command line with apt-get
- 01-21-2009 #3Shouldn't the include line be:#include "stdio.h"
main()
{
printf("hello\n");
return 0;
}
Code:#include <stdio.h>
- 01-22-2009 #4Just Joined!
- Join Date
- Jan 2009
- Posts
- 7
no
#include "stdio.h"
is valid will you give me the download link fo that build-essential package. . .
- 01-22-2009 #5Code:
sudo apt-get install build-essential
Linux User #453176
- 01-22-2009 #6Just Joined!
- Join Date
- Jan 2009
- Posts
- 7
now another problem
that error has been solved but now i am getting following exception while running my java code
java.lang.UnsatisfiedLinkError: Unable to load library
for this i think some path setting is needed
pls help
- 01-22-2009 #7
maybe if you give us the source we can figure it out. Maybe you just made a syntax error, or you haven't installed a required library. We can't see that from what we've got here(at least, I can't).
- 01-23-2009 #8Just Joined!
- Join Date
- Jan 2009
- Posts
- 7
here is the src
i am using netbeans 6.5 IDE on ubuntu
i have made the .so file for following c code
int add(int a,int b){
return(a+b);
}
and when i try to load this libarary(.so file ) i get the following exception
java.lang.UnsatisfiedLinkError: Unable to load library
my java code is
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;
/** Simple example of native library declaration and usage. */
public class HelloWorld {
public interface CLibrary extends Library {
CLibrary INSTANCE = (CLibrary)
Native.loadLibrary("temp",CLibrary.class);
int add(int a,int b);
}
public static void main(String[] args) {
int b = CLibrary.INSTANCE.add(2, 3);
System.out.println(b);
}
error
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'temp': libtemp.so: cannot open shared object file: No such file or directory
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrar y.java:114)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrar y.java:157)
at com.sun.jna.Library$Handler.<init>(Library.java:12 3)
at com.sun.jna.Native.loadLibrary(Native.java:260)
at com.sun.jna.Native.loadLibrary(Native.java:246)
at helloworljna.HelloWorld$CLibrary.<clinit>(HelloWor ld.java:22)
at helloworljna.HelloWorld.main(HelloWorld.java:31)
Java Result: 1
i 've use following command to set path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
pls tell how to solve
giving full path to".so" file is not working even


Reply With Quote
