solving one errors create new one

How is it possible that eclipse shoes me just one error. after i solve this
it shows me 5 different errors.
does not all of the errors appearr at once?
i am working on xilinx sdk 2018.3 which is based on eclipse.
That's way too vague to give a concrete answer.

But sometimes your code may contain syntax errors that makes it impossible to be parsed. There may be other errors lurking in your code, but as long as the code cannot even be parsed, the compiler won't be able to tell.

Once the syntax error is resolved and the code can actually be parsed, other errors may become evident, such as trying to access a variable that was never declared, or call a function that was never declared, etc. pp...

Also, often the compiler only shows the first instance of a particular type of error, even though there may be several instances of that error in your code. Consequently, if you only fix the first instance of the error, the other instances still exist; and the compiler will then reported the next instance.

Last but not least, "fixing an error" means that you changed the code, in some way. And, of course, any code change has the potential of breaking something and thus introduce new errors 😏
Last edited on
Hi great answer.

I will be more specific.

i have bunch of cpp and h files that need to compile.
some of the lines gives errors:

1
2
3
4
5
6

S16BIT _DECL aceRTMTConfigure (S16BIT swDevice, U16BIT wRtCommandStackSize,	U16BIT wMtStackMode,	U16BIT wMtCommandStackSize,	U16BIT wMtDataStackSize, U16BIT wOptions) { return sitalRtMt_Initialize (swDevice, wRtCommandStackSize,	wMtStackMode, wMtCommandStackSize,	wMtDataStackSize, wOptions); }

 }



the error it gives:

Multiple markers at this line
- 'sitalRtMt_Initialize' was not declared in
this scope
- suggested alternative: 'sitalMt_Initialize'

Although when i cntl+click 'sitalRtMt_Initialize' it give me reference to 2 places in a window called "open decleration", mean that it was declared !? so why it gives error in the first place?
Just because a function, class or type is declared somewhere does not necessarily mean that the declaration actually is "available" at the place where you want to use it 😏

You generally have to #include the header file where something that you want to use is declared before you can use it. And you have to do this separately, in every source code file, where you want to use it.

Also, C++ has namespaces. If symbol foobar is declared in a certain namespace, then you either have to use the syntax some_namespace::foobar, or you have to use write using some_namespace; a the top your source code file and then you can access foobar without namespace prefix.
Last edited on
Oh .

so what can i do to fix it? what could be wrong?
i think it has something to do with path/include settings.

moreover , the error seem to be on lines that are not part of what i #define in the beginningπŸ˜’
(gray area)
Last edited on
Sure, there error occurs at the place where you try to use a symbol that was not declared yet.
'sitalRtMt_Initialize' was not declared in this scope


Assuming that the "missing" symbol is declared in some header file, you have to #include that header file!

And you have to do this before you actually try to access the symbol...
Last edited on
You need to:

a) #include the relevant header file, i.e. the header file containing the definitions you need, within that source file
b) Ensure you're using the right namespace qualifications for the symbols you're using

i think it has something to do with path/include settings.

If that were the case, you'd probably be getting preprocessor errors reporting that header files can't be found. Are you getting such errors?
No.
it is weird because if i include that header file, other errors came up.

#include "stld2ddc.h"

There's a bit of a requirement for mind-reading here: "other errors".

Why don't you just show your code - preferably a minimal example that reproduces the problem (i.e. ought to run on its own).

If it uses external libraries then I'm sure that you can provide a link. AceXtreme ?

"It doesn't work" and "there are errors" are not very helpful descriptions of the problem.
Last edited on
it is weird because if i include that header file, other errors came up.


Possibly because that file also has dependencies which require another #include file to be used which might have other dependencies which ...

This is a typical rabbit hole with #includes - once started you're no idea where it might lead!

Now if there was an IDE add-in that analysed code and reported what #includes were needed and in what order... Wistful thinking!
ok . it is too complex code.

Show it will make it clear.

Zoom help from someone?
Generally, if a header file 'A' requires another header file 'B', then the header file 'A' should #include header file 'B' – instead of requiring the user to #include 'B' before 'A' can be #include'd. And all header files should contain proper "include guards" to avoid problems when the same header file gets included multiple times.

But "should" does not mean it was actually made that way, so better double-check 😏
Last edited on
From where was this code obtained (assuming not in-house)? Are there no instructions/help/manual etc re how to use?

PS. xlinix is an Integrated Design Environment for creating embedded applications. The web site has manuals, help, support etc. Do these not state how to use the SDK within a program etc?

https://www.xilinx.com/support.html
Last edited on
some issue i had:
library properties-->c/c++ build -->settings-->toll settings-->symbols

i choose for example LINUX as symbol. mean only #if defined LINUX will be white and the rest
will shows gray . but why the compiler check and shows errors in this gray area?
The syntax highlighting in your IDE (e.g. Eclipse) tries to be "smart", and therefore it grays out lines that it "thinks" are disabled by #if 's, based on which macros (e.g. LINUX) the IDE "thinks" are #define'd.

But, what really happens in the compiler, that is (or: may be) a different story 😏

Be aware that a macro (e.g. LINUX) will be defined only if either there is a #define in the code, possibly in one of the header file that you include, or if you pass command-line option -D to the compiler (e.g. -DLINUX).

Do not blindly trust that syntax highlighting always is "in sync" with what happens in the compiler.
Last edited on
Topic archived. No new replies allowed.