[SOLVED] 'Symbol could not be resolved' in Eclipse

Applications, development tools, FPGA, C, WEB
Simonx
Posts: 16
Joined: Mon May 04, 2015 10:50 am
Location: France

[SOLVED] 'Symbol could not be resolved' in Eclipse

Post by Simonx » Tue May 05, 2015 8:51 am

Hello!

Another problem I currently have, is that Eclipse constantly tells me that there are some errors in the RedPitaya's source code, but it compiles successfully!
For example :

Code: Select all

Symbol 'stderr' could not be resolved
Type 'uint32_t' could not be resolved
Type 'int32_t' could not be resolved
Type 'FILE' could not be resolved
I was able to make them disappear by doing this : right click on my project -> Properties -> C/C++ General -> Paths and Symbols, then I added "C:\MinGW\include" to the GNU C Includes.
It works but this error still remains...

Code: Select all

Symbol 'NULL' could not be resolved
This is not a problem for compiling (I guess), since Eclipse agrees to compile it despite this error, and the resulting file works just fine. But it's really annoying to see this while programming...

Does anyone have a solution for me? I already looked on the forum but did not find how to solve that.
Thank you very much!
Last edited by Simonx on Wed May 06, 2015 9:11 am, edited 2 times in total.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: 'Symbol could not be resolved' in Eclipse

Post by Nils Roos » Tue May 05, 2015 11:21 am

To have a full set of symbols, you'll need to set these include paths:
<linaro>/arm-linux-gnueabi/include
<linaro>/arm-linux-gnueabi/libc/usr/include
<linaro>/arm-linux-gnueabi/libc/usr/include/arm-linux-gnueabi
<linaro>/lib/gcc/arm-linux-gnueabi/4.6.3/include
<linaro>/lib/gcc/arm-linux-gnueabi/4.6.3/include-fixed
and remove the MinGW reference.

But you don't need to set these manually. If you create a new project and select "Cross GCC" in the "Toolchains:" list, you will be prompted for the "Cross compiler prefix:" and the "Cross compiler path:". Enter "arm-linux-gnueabi-" and the path to linaro's install directory here and eclipse CDT will fill in the correct includes all by itself.

Simonx
Posts: 16
Joined: Mon May 04, 2015 10:50 am
Location: France

Re: 'Symbol could not be resolved' in Eclipse

Post by Simonx » Tue May 05, 2015 12:54 pm

Thank you very much Nils, that solved my problem...!

Now, following this page, I added rp.h to my project, wrote '#include "rp.h"' in my program, and added the following lines :

Code: Select all

		rp_DpinSetState(RP_LED1, RP_HIGH);
			{	...	}
		rp_DpinSetState(RP_LED1, RP_LOW);
And I got the following error "undefined reference to `rp_DpinSetState'", twice.
I checked my rp.h file and rp_DpinSetState is OK :

Code: Select all

int rp_DpinSetState(rp_dpin_t pin, rp_pinState_t state);
I have no rp.o file to add to my Makefile, and I also tried to make a new program with just the code from the example, but I got the same error...

How could I solve this, please? Tell me if I have to create a new thread to talk about this problem, I'll do it ! ;)
Thanks!

Simon

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: 'Symbol could not be resolved' in Eclipse

Post by Nils Roos » Tue May 05, 2015 1:42 pm

You need to tell the linker to use the librp.so library with the "-lrp" directive. Additionally, the path to librp.so has to be known to the linker, so either copy or symlink it to one of the standard library search locations or tell the linker to look in another directory with "-L...".

Simonx
Posts: 16
Joined: Mon May 04, 2015 10:50 am
Location: France

Re: 'Symbol could not be resolved' in Eclipse

Post by Simonx » Tue May 05, 2015 4:50 pm

[EDIT: Well, today, it seems everything works just fine... I thought I rebooted VB yesterday but I may be wrong...!]

Once again, thank you Nils for your huge help.
Old message wrote:(I think) I did what you mentionned, ie. I copied librp.so from /SDK/include/ to /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/ which is a folder containing libraries.
(I thought some of the errors where due to the fact I'm using windows, so I installed Ubuntu via VirtualBox)

Here is the log that I get now, on windows :

Code: Select all

make CROSS_COMPILE=arm-linux-gnueabi- all 
arm-linux-gnueabi-gcc -c -g -std=gnu99 -Wall -Werror -DVERSION=0.10-0000 -DREVISION=simbuild fpga_osc.c -o fpga_osc.o
arm-linux-gnueabi-gcc -c -g -std=gnu99 -Wall -Werror -DVERSION=0.10-0000 -DREVISION=simbuild main_osc.c -o main_osc.o
arm-linux-gnueabi-gcc -c -g -std=gnu99 -Wall -Werror -DVERSION=0.10-0000 -DREVISION=simbuild worker.c -o worker.o
arm-linux-gnueabi-gcc -c -g -std=gnu99 -Wall -Werror -DVERSION=0.10-0000 -DREVISION=simbuild fpga_awg.c -o fpga_awg.o
arm-linux-gnueabi-gcc -c -g -std=gnu99 -Wall -Werror -DVERSION=0.10-0000 -DREVISION=simbuild trigg.c -o trigg.o
arm-linux-gnueabi-gcc -o trigg fpga_osc.o main_osc.o worker.o fpga_awg.o trigg.o -g -std=gnu99 -Wall -Werror -DVERSION=0.10-0000 -DREVISION=simbuild -lm -lrp
c:/linaro/bin/../lib/gcc/arm-linux-gnueabi/4.6.3/../../../../arm-linux-gnueabi/lib/librp.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Makefile:54: recipe for target 'trigg' failed
make: *** [trigg] Error 1
And Linux :

Code: Select all

make all 
arm-linux-gnueabi-gcc -o api_test blink_diode.o -g -std=gnu99 -Wall -Werror -L ../../api-mockup/rpbase -lm -lpthread -lrp
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: can't find -lrp
collect2:  ld returned 1 exit status
make: *** [api_test] Error 1
[/size]

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: 'Symbol could not be resolved' in Eclipse

Post by amin » Fri Mar 10, 2017 6:35 am

Nils Roos wrote:You need to tell the linker to use the librp.so library with the "-lrp" directive. Additionally, the path to librp.so has to be known to the linker, so either copy or symlink it to one of the standard library search locations or tell the linker to look in another directory with "-L...".
Hi Nils Ros
I want to edit led bar in bode.c but i didnot found rp_DpinSetState and another LED declaration.
its difficult for me to operate it
To have a full set of symbols, you'll need to set these include paths:
<linaro>/arm-linux-gnueabi/include
<linaro>/arm-linux-gnueabi/libc/usr/include
<linaro>/arm-linux-gnueabi/libc/usr/include/arm-linux-gnueabi
<linaro>/lib/gcc/arm-linux-gnueabi/4.6.3/include
<linaro>/lib/gcc/arm-linux-gnueabi/4.6.3/include-fixed
and remove the MinGW reference.

But you don't need to set these manually. If you create a new project and select "Cross GCC" in the "Toolchains:" list, you will be prompted for the "Cross compiler prefix:" and the "Cross compiler path:". Enter "arm-linux-gnueabi-" and the path to linaro's install directory here and eclipse CDT will fill in the correct includes all by itself.

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: 'Symbol could not be resolved' in Eclipse

Post by amin » Fri Mar 10, 2017 6:58 am

Nils Roos wrote:You need to tell the linker to use the librp.so library with the "-lrp" directive. Additionally, the path to librp.so has to be known to the linker, so either copy or symlink it to one of the standard library search locations or tell the linker to look in another directory with "-L...".
also how to operate this code -lrp and lbrp.so.
can you explain detail please..
if i want to edit led bar in bode.c should i modified again the linker?

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: [SOLVED] 'Symbol could not be resolved' in Eclipse

Post by Nils Roos » Fri Mar 10, 2017 1:47 pm

Hi Nils Ros
I want to edit led bar in bode.c but i didnot found rp_DpinSetState and another LED declaration.
its difficult for me to operate it
...
also how to operate this code -lrp and lbrp.so.
can you explain detail please..
if i want to edit led bar in bode.c should i modified again the linker?
First of all, the bode program in its current form is not using the RP api. This means that you must add the api infrastructure to the Makefile first like so:

Code: Select all

LIBS=-L../../api/lib/ -lm -lpthread -lrp
In bode.c you must include rp.h and initialize the api by calling rp_Init() somewhere early on, before you can start using other rp_... functions. Calling rp_Release() before exiting is also recommended.

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: [SOLVED] 'Symbol could not be resolved' in Eclipse

Post by amin » Fri Mar 10, 2017 3:09 pm

this is my sample code that i add from bode.c

#include "redpitaya/rp.h"
int main(int argc, char *argv[]) {

/** Set program name */
g_argv0 = argv[0];


/* Print error, if rp_Init() function failed */
if(rp_Init() != RP_OK){
fprintf(stderr, "Rp api init failed!\n");
}


/// Showtime.
for ( fr = 0; fr < steps; fr++ ) {
//int unsigned led;
/* scale type dictates frequency used in for iterations */
if ( scale_type ) { // log scle
k = powf( 10, ( c * (float)fr ) + a );
frequency[ fr ] = k ;
}
else { // lin scale
//frequency[ fr ] = start_frequency + ( frequency_step * fr );
frequency[ fr ] = start_frequency + ( frequency_step * 0 );
//rp_DpinSetState (RP_LED0,RP_LOW);
rp_DpinSetState(RP_LED0, RP_HIGH);
}
// rp_DpinSetState (RP_LED0,0);
rp_DpinSetState(RP_LED0, RP_LOW);

/** All's well that ends well. */
rp_Release();
return 1;
}

is it correct?

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: [SOLVED] 'Symbol could not be resolved' in Eclipse

Post by amin » Fri Mar 10, 2017 3:14 pm

but in original bode code is already generate LED.
How to disable original LED bar in bode code eventhough i will make new LED code using api now

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 15 guests