Reputation: 1713
In the source file (which is from a shared object / DLL), I get OKAY could not be resolved
, although it is in the header. The header is in another project but I dont think that should be related, as ppackage is resolved properly ?
Update, here the source:
Build output from building foor project.
make all
Building file: ../src/foor.c
Invoking: GCC C Compiler
gcc -I"/home/lk/proj/m5/m5/src/include" -O0 -g3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/foor.d" -MT"src/foor.d" -o "src/foor.o" "../src/foor.c"
In file included from ../src/foor.c:9:0:
/home/lk/proj/m5/m5/src/include/m5.h:33:3: warning: #warning ohshit
../src/foor.c:12:1: warning: missing braces around initializer
../src/foor.c:12:1: warning: (near initialization for 'fs[1]')
Finished building: ../src/foor.c
Building target: libfoor.so
Invoking: GCC C Linker
gcc -shared -o "libfoor.so" ./src/foor.o
Finished building target: libfoor.so
header:
#include <stdio.h>
enum {
OKAY = 0,
ERR,
ERRANY,
// list shortened
ERRNOTFOUND,
};
typedef struct { ..foobars.. } ppackage;
source file:
#include <header.h> // Did add -I ../include, where the header is
ppackage knock(ppackage *in)
{
return OKAY; // ERROR
}
Upvotes: 0
Views: 2503
Reputation: 83
It is not clear, that your enum is related to ..foobars..
Ppackage knock(ppackage *in) should have a return value of type ppackage, which is a struct { ..foobars..}
Does
typedef enum {
OKAY = 0,
ERR,
ERRANY,
// list shortened
ERRNOTFOUND,
} preturnvalue_t;
with a function
preturnvalue_t knock(ppackage *in)
{
return OKAY; // ERROR
}
do what you need?
Lutz
Upvotes: 0
Reputation: 399949
If you include the header, then all the code in that header could just as well have been pasted into your C source file at the point where the #include
directive is.
It sounds strange that it isn't working.
One thing to do would be to use quotes rather than angle brackets for the include, since you're including a 3rd-party header.
Also, please include exact compiler output.
Upvotes: 2