Help opening a file in Visual Studio 2008 - c

I'm trying to use Visual Studio 2008 since I had problems opening a file in XCode. I am new to VS, but these are the steps I took. I created a new project, selected Win32 Console Application, empty project. My code is:
// C_test.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <stdlib.h>
int main(void )
{
printf("Hello");
FILE *filePtr;
filePtr = fopen( "test.txt", "r" );
if (filePtr == NULL)
{
fprintf(stderr, "Can't open \"test\"\n");
exit(EXIT_FAILURE);
}
else
{
int x;
printf("File open successful\n");
/* read one character at a time until EOF is reached */
while ((x = fgetc(filePtr)) != EOF)
{
//printf("%c", x);
fprintf(stderr, "%x\n",x);
}
}
fclose(filePtr);
system("pause");
return 0;
}
Something doesn't seem to be correct since my error list is:
>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(9) : error C2275: 'FILE' : illegal use of this type as an expression
1> c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(69) : see declaration of 'FILE'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(9) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(11) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(11) : warning C4047: '=' : 'int' differs in levels of indirection from 'FILE *'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(12) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(12) : warning C4047: '==' : 'int' differs in levels of indirection from 'void *'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(23) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(23) : warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(23) : warning C4024: 'fgetc' : different types for formal and actual parameter 1
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(29) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(29) : warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(29) : warning C4024: 'fclose' : different types for formal and actual parameter 1
1>Build log was saved at "file://c:\Documents and Settings\jon\My Documents\Visual Studio 2008\Projects\C_test\C_test\Debug\BuildLog.htm"
1>C_test - 6 error(s), 6 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any thoughts? Sorry if this is a>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(9) : error C2275: 'FILE' : illegal use of this type as an expression
1> c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(69) : see declaration of 'FILE'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(9) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(11) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(11) : warning C4047: '=' : 'int' differs in levels of indirection from 'FILE *'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(12) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(12) : warning C4047: '==' : 'int' differs in levels of indirection from 'void *'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(23) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(23) : warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(23) : warning C4024: 'fgetc' : different types for formal and actual parameter 1
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(29) : error C2065: 'filePtr' : undeclared identifier
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(29) : warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
1>c:\documents and settings\jon\my documents\visual studio 2008\projects\c_test\c_test\main.c(29) : warning C4024: 'fclose' : different types for formal and actual parameter 1
1>Build log was saved at "file://c:\Documents and Settings\jon\My Documents\Visual Studio 2008\Projects\C_test\C_test\Debug\BuildLog.htm"
1>C_test - 6 error(s), 6 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any thoughts? Thanks!

You can only declare variables at the top of a scope {} before any code in C.
In C++ you can declare them anywhere. So either change your filename to test.cpp or
move your first printf down below the declaration of FILE* fileptr.
int main(void )
{
FILE *filePtr;
printf("Hello");

Related

Undeclared variable error when compiling HPC Challenge Benchmark

I want to compile and run HPC Challenge benchmark on my server.
When I want to make hpcc-1.5.0 with mpicc compiler I get this error:
../../../../STREAM/stream.c:178:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘a’
static double * restrict a, * restrict b, * restrict c;
^
../../../../STREAM/stream.c: In function ‘checkSTREAMresults’:
../../../../STREAM/stream.c:263:16: error: ‘a’ undeclared (first use in this function)
if (fabs(a[j]/aj-1.0) > epsilon) {
^
../../../../STREAM/stream.c:263:16: note: each undeclared identifier is reported only once for each function it appears in
../../../../STREAM/stream.c:280:16: error: ‘b’ undeclared (first use in this function)
if (fabs(b[j]/bj-1.0) > epsilon) {
^
../../../../STREAM/stream.c:297:16: error: ‘c’ undeclared (first use in this function)
if (fabs(c[j]/cj-1.0) > epsilon) {
^
../../../../STREAM/stream.c: In function ‘computeSTREAMerrors’:
../../../../STREAM/stream.c: In function ‘HPCC_Stream’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Copy’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Scale’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Add’:
../../../../STREAM/stream.c: In function ‘tuned_STREAM_Triad’:
make[1]: *** [../../../../STREAM/stream.o] Error 1
make[1]: Leaving directory `/root/hpcc-1.5.0/hpl/lib/arch/build'
make: *** [all] Error 2
It seems STREAM uses some variables that is not declared.
This is because of using restrict keywords for the array. To compile stream, you have to use -std=c99 option.
Add -std=c99 flag in your Make.$(arch) file in CCFLAGS section. Like this:
CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -std=c99
Source: https://anilmaurya.wordpress.com/2016/04/26/hpc-1-5-0-compile-time-error/

Why does my Thrift (c_glib) example fail to compile with "error: invalid conversion"?

I'm trying out the thrift c_glib example (minimal version just with ping) that is available in the official thrift website, but whenever i compile the code (gcc or make) it fails with following reason:
thrift-server.c: In function ‘int main()’:
thrift-server.c:186:23: error: invalid conversion from ‘gpointer {aka void*}’ to ‘TutorialCalculatorHandler* {aka _TutorialCalculatorHandler*}’ [-fpermissive]
NULL);
^
thrift-server.c:194:23: error: invalid conversion from ‘gpointer {aka void*}’ to ‘CalculatorProcessor* {aka _CalculatorProcessor*}’ [-fpermissive]
NULL);
^
thrift-server.c:201:23: error: invalid conversion from ‘gpointer {aka void*}’ to ‘ThriftServerTransport* {aka _ThriftServerTransport*}’ [-fpermissive]
NULL);
^
thrift-server.c:208:23: error: invalid conversion from ‘gpointer {aka void*}’ to ‘ThriftTransportFactory* {aka _ThriftTransportFactory*}’ [-fpermissive]
NULL);
^
thrift-server.c:214:23: error: invalid conversion from ‘gpointer {aka void*}’ to ‘ThriftProtocolFactory* {aka _ThriftProtocolFactory*}’ [-fpermissive]
NULL);
^
thrift-server.c:225:23: error: invalid conversion from ‘gpointer {aka void*}’ to ‘ThriftServer* {aka _ThriftServer*}’ [-fpermissive]
NULL);
^
thrift-server.c:176:7: warning: unused variable ‘exit_status’ [-Wunused-variable]
int exit_status = 0;
^
thrift-server.c: At global scope:
thrift-server.c:154:1: warning: ‘void sigint_handler(int)’ defined but not used [-Wunused-function]
sigint_handler (int signal_number)
^
make: *** [server] Error 1
Any pointers will be really helpful. My GCC version is 4.8.2 and I'm on a ubuntu 14.10 box
And my makefile looks like this:
default: server
server: thrift-server.c
gcc -g -Wall -Wextra -pedantic -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -g -O2 -o thrift-server.o -c thrift-server.c /home/akhld/mobi/localcluster/codes/private/simdprototype/thrift-0.9.2/tutorial/c_glib/.libs/libtutorialgencglib.a -lgobject-2.0 -lglib-2.0 /home/akhld/mobi/localcluster/codes/private/simdprototype/thrift-0.9.2/lib/c_glib/.libs/libthrift_c_glib.so /home/akhld/mobi/localcluster/codes/private/simdprototype/thrift-0.9.2/lib/c_glib/.libs/libthrift_c_glib.so -lssl -lcrypto -lrt -lpthread -Wl,-rpath -Wl,/home/akhld/mobi/localcluster/codes/private/simdprototype/thrift-0.9.2/lib/c_glib/.libs
This is how my .thrift file looks like:
namespace cpp tutorial
service Calculator {
void ping()
}
And this is the thrift-server.c:
http://pastebin.com/Q4SGAdMu
Try compiling your code with gcc, not g++ (change the last line of your makefile). C++, but not C, requires explicit conversions from void *.
If you must use g++ for some reason, try instead adding an explicit cast to each call to g_object_new, e.g.:
handler = (TutorialCalculatorHandler *)
g_object_new (TYPE_TUTORIAL_CALCULATOR_HANDLER,
NULL);

Installing FTDI device drivers on linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I was trying to install the Virtual COM drivers from FTDI (http://www.ftdichip.com/Drivers/VCP/Linux/ftdi_sio.tar.gz) on ubuntu 10.04.
I downloaded the file and tried to compile it. But it shows errors like these:
Can anybody tell me the reason?
I installed the linux kernel development packages
Below is the output of make.
I removed some parts because of the size limitation
sudo make
gcc -Wall -D__KERNEL__ -DMODULE -I/lib/modules/2.6.32-41-generic/build/include -D__SMP__ -DSMP -DMODVERSIONS -include /lib/modules/2.6.32-41-generic/build/include/linux/modversions.h -I/usr/src/linux-2.6.32-41-generic/drivers/usb/serial/ -O -c -o ftdi_sio.o ftdi_sio.c
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:11,
from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/linkage.h:5:25: error: asm/linkage.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:15,
from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:17:24: error: asm/bitops.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:15,
from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘get_bitmask_order’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:29: warning: implicit declaration of function ‘fls’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘hweight_long’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:45: warning: implicit declaration of function ‘hweight32’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:45: warning: implicit declaration of function ‘hweight64’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘fls_long’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:132: warning: implicit declaration of function ‘fls64’
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h: In function ‘__ffs64’:
/lib/modules/2.6.32-41-generic/build/include/linux/bitops.h:147: warning: implicit declaration of function ‘__ffs’
In file included from ftdi_sio.c:251:
/lib/modules/2.6.32-41-generic/build/include/linux/kernel.h:21:21: error: asm/bug.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:56:29: error: asm/thread_info.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:65: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:65: warning: its scope is only this definition or declaration, which is probably not what you want
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘set_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:67: warning: implicit declaration of function ‘set_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:67: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:70: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘clear_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:72: warning: implicit declaration of function ‘clear_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:72: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:75: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘test_and_set_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:77: warning: implicit declaration of function ‘test_and_set_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:77: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:80: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘test_and_clear_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:82: warning: implicit declaration of function ‘test_and_clear_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:82: error: dereferencing pointer to incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:85: warning: ‘struct thread_info’ declared inside parameter list
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h: In function ‘test_ti_thread_flag’:
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:87: warning: implicit declaration of function ‘test_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/thread_info.h:87: error: dereferencing pointer to incomplete type
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/list.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
/lib/modules/2.6.32-41-generic/build/include/linux/prefetch.h:15:23: error: asm/cache.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/preempt.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/list.h:7:24: error: asm/system.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h: In function ‘smp_mb__after_lock’:
/lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:137: warning: implicit declaration of function ‘smp_mb’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/spinlock.h:321:24: error: asm/atomic.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/wait.h:26:25: error: asm/current.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:15,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h: In function ‘write_seqlock’:
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h:64: warning: implicit declaration of function ‘smp_wmb’
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h: In function ‘read_seqbegin’:
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h:93: warning: implicit declaration of function ‘cpu_relax’
/lib/modules/2.6.32-41-generic/build/include/linux/seqlock.h:96: warning: implicit declaration of function ‘smp_rmb’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/bitmap.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:95,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:16,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/string.h:21:24: error: asm/string.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:16,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h: In function ‘__first_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:239: warning: implicit declaration of function ‘find_first_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h: In function ‘__next_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:245: warning: implicit declaration of function ‘find_next_bit’
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h: In function ‘__first_unset_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/nodemask.h:263: warning: implicit declaration of function ‘find_first_zero_bit’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:20:22: error: asm/page.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:353: error: expected specifier-qualifier-list before ‘atomic_long_t’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/notifier.h:13,
from /lib/modules/2.6.32-41-generic/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:666,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mutex.h: In function ‘mutex_is_locked’:
/lib/modules/2.6.32-41-generic/build/include/linux/mutex.h:118: warning: implicit declaration of function ‘atomic_read’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/notifier.h:14,
from /lib/modules/2.6.32-41-generic/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:666,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:666,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/notifier.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/notifier.h:62: error: field ‘rwsem’ has incomplete type
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h: In function ‘populated_zone’:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:699: error: ‘struct zone’ has no member named ‘present_pages’
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h: In function ‘is_normal’:
/lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:748: error: ‘struct zone’ has no member named ‘zone_pgdat’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:7,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/topology.h:34:26: error: asm/topology.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmdebug.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/autoconf.h:991:1: warning: "CONFIG_NR_CPUS" redefined
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/mmzone.h:12,
from /lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:4,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/threads.h:16:1: warning: this is the location of the previous definition
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:12,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h: In function ‘allocflags_to_migratetype’:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:121: warning: implicit declaration of function ‘WARN_ON’
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h: In function ‘gfp_zone’:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: ‘ZONE_DMA’ undeclared (first use in this function)
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: (Each undeclared identifier is reported only once
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: for each function it appears in.)
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:219: error: ‘ZONE_HIGHMEM’ undeclared (first use in this function)
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h: In function ‘alloc_pages_node’:
/lib/modules/2.6.32-41-generic/build/include/linux/gfp.h:284: warning: implicit declaration of function ‘cpu_to_node’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/time.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:24,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/math64.h:5:23: error: asm/div64.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/time.h:9,
from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:24,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/math64.h: In function ‘div_u64_rem’:
/lib/modules/2.6.32-41-generic/build/include/linux/math64.h:43: warning: implicit declaration of function ‘do_div’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:25,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/timex.h:170:23: error: asm/timex.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/ktime.h:25,
from /lib/modules/2.6.32-41-generic/build/include/linux/timer.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:8,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
/lib/modules/2.6.32-41-generic/build/include/linux/jiffies.h:257:31: error: division by zero in #if
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:11,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:26: error: expected specifier-qualifier-list before ‘atomic_long_t’
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h: In function ‘cancel_delayed_work’:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:240: error: ‘struct work_struct’ has no member named ‘data’
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h: In function ‘__cancel_delayed_work’:
/lib/modules/2.6.32-41-generic/build/include/linux/workqueue.h:255: error: ‘struct work_struct’ has no member named ‘data’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/kmemtrace.h:12,
from /lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:13,
from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/trace/events/kmem.h: In function ‘trace_kmalloc’:
/lib/modules/2.6.32-41-generic/build/include/trace/events/kmem.h:47: warning: implicit declaration of function ‘smp_read_barrier_depends’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/slab.h:162,
from ftdi_sio.c:254:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:53: error: expected specifier-qualifier-list before ‘atomic_long_t’
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:142: error: ‘PAGE_SHIFT’ undeclared here (not in a function)
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h: In function ‘kmalloc_large’:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:232: warning: implicit declaration of function ‘get_order’
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:236: error: ‘PAGE_SIZE’ undeclared (first use in this function)
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h: In function ‘kmalloc’:
/lib/modules/2.6.32-41-generic/build/include/linux/slub_def.h:246: error: ‘PAGE_SIZE’ undeclared (first use in this function)
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/fs.h:369,
from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/dcache.h: In function ‘dget’:
/lib/modules/2.6.32-41-generic/build/include/linux/dcache.h:336: warning: implicit declaration of function ‘BUG_ON’
/lib/modules/2.6.32-41-generic/build/include/linux/dcache.h:337: warning: implicit declaration of function ‘atomic_inc’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/fs.h:470,
from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/quota.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/quota.h:384: error: field ‘dqptr_sem’ has incomplete type
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:748: error: field ‘i_alloc_sem’ has incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:926: error: expected specifier-qualifier-list before ‘atomic_long_t’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:9,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:1337: error: field ‘s_umount’ has incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h: In function ‘file_accessed’:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:1738: error: ‘struct file’ has no member named ‘f_flags’
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h: In function ‘put_write_access’:
/lib/modules/2.6.32-41-generic/build/include/linux/fs.h:2130: warning: implicit declaration of function ‘atomic_dec’
In file included from /usr/include/asm/termios.h:1,
from /lib/modules/2.6.32-41-generic/build/include/linux/termios.h:5,
from /lib/modules/2.6.32-41-generic/build/include/linux/tty.h:11,
from ftdi_sio.c:255:
/lib/modules/2.6.32-41-generic/build/include/asm-generic/termios.h:51:25: error: asm/uaccess.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/module.h:14,
from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/elf.h:7:21: error: asm/elf.h: No such file or directory
In file included from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:20:23: error: asm/local.h: No such file or directory
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:21:24: error: asm/module.h: No such file or directory
In file included from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:302: error: field ‘arch’ has incomplete type
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:319: error: expected specifier-qualifier-list before ‘Elf_Sym’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:455: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/lib/modules/2.6.32-41-generic/build/include/linux/module.h: In function ‘__module_get’:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:470: warning: implicit declaration of function ‘local_inc’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:470: warning: implicit declaration of function ‘__module_ref_addr’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:472: warning: implicit declaration of function ‘local_read’
In file included from ftdi_sio.c:258:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h: At top level:
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:712: warning: type defaults to ‘int’ in declaration of ‘Elf_Ehdr’
/lib/modules/2.6.32-41-generic/build/include/linux/module.h:712: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:14,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/delay.h:14:23: error: asm/delay.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:14,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/delay.h: In function ‘ndelay’:
/lib/modules/2.6.32-41-generic/build/include/linux/delay.h:39: warning: implicit declaration of function ‘udelay’
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/interrupt.h:12,
from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:15,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/hardirq.h:10:25: error: asm/hardirq.h: No such file or directory
In file included from /lib/modules/2.6.32-41-generic/build/include/linux/interrupt.h:13,
from /lib/modules/2.6.32-41-generic/build/include/linux/usb.h:15,
from ftdi_sio.c:261:
/lib/modules/2.6.32-41-generic/build/include/linux/irqflags.h:57:26: error: asm/irqflags.h: No such file or directory
I'm thinking your missing the asm symlink. I didn't go through everything, but a lot of these errors are missing "asm/XXXX.h".
Let's take a look at the first error. Check your include directory in your kernel:
#/usr/src/linux/include> ls
In this directory you should have a "linux" directory, which should contain linkage.h. Opening this we see:
#include <asm/linkage.h>
So it's looking for an "asm" directory in /usr/src/linux/include. Do you have on there? Is it pointing at the correct architecture for your system? Here's the top of my linux/include
mike#linux-4puc:/usr/src/linux/include> ls -l
total 120
drwxr-xr-x 3 root root 4096 Aug 1 10:51 acpi
lrwxrwxrwx 1 root root 47 Aug 1 12:08 asm -> /usr/src/linux-3.1.10-1.16/arch/x86/include/asm
My system didn't originally have this symlink so I had to add it in when I started via:
mike#linux-4puc:/usr/src/linux/include> ln -s /usr/src/linux-3.1.10-1.16/arch/x86/include/asm asm

error: ‘CODEC_TYPE_AUDIO’ undeclared when make m3u8-segmenter

I want to make m3u8-segmenter for Http Live Stream: https://github.com/johnf/m3u8-segmenter
There are errors when I make, the errors are:
gcc -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings -Werror m3u8-segmenter.c -o m3u8-segmenter -lavformat -lavcodec -lavutil
m3u8-segmenter.c: In function ‘add_output_stream’:
m3u8-segmenter.c:82:14: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:82:14: note: each undeclared identifier is reported only once for each function it appears in
m3u8-segmenter.c:94:14: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c: In function ‘main’:
m3u8-segmenter.c:338:5: error: ‘av_open_input_file’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1090) [-Werror=deprecated-declarations]
m3u8-segmenter.c:352:5: error: implicit declaration of function ‘guess_format’ [-Werror=implicit-function-declaration]
m3u8-segmenter.c:352:5: error: nested extern declaration of ‘guess_format’ [-Werror=nested-externs]
m3u8-segmenter.c:352:10: error: assignment makes pointer from integer without a cast [-Werror]
m3u8-segmenter.c:371:18: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c:376:18: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:387:5: error: ‘av_set_parameters’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434) [-Werror=deprecated-declarations]
m3u8-segmenter.c:392:5: error: ‘dump_format’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1559) [-Werror=deprecated-declarations]
m3u8-segmenter.c:406:5: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:411:5: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:444:67: error: ‘PKT_FLAG_KEY’ undeclared (first use in this function)
m3u8-segmenter.c:455:13: error: ‘put_flush_packet’ is deprecated (declared at /usr/local/include/libavformat/avio.h:293) [-Werror=deprecated-declarations]
m3u8-segmenter.c:456:13: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
m3u8-segmenter.c:476:13: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:482:13: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:514:5: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [all] Error 1
You're getting those errors because for some reason, this block in libav_compat.h took effect:
/* Support older versions of ffmpeg and libav */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
But whichever headers are supposed to define CODEC_TYPE_AUDIO and CODEC_TYPE_VIDEO don't. From the comment there, it looks like you probably should update your other software (ffmpeg and/or libav) and then try again.

Compiling a program with a legacy version of gcc

This is probably a very difficult problem to troubleshoot with the information I can practically provide, but I'm hoping someone might be able to at least point me in a possible direction.
I'm trying to install HTK (http://htk.eng.cam.ac.uk/), which, according to this page needs to be installed using gcc 3.4. Their method of implementing backwards compatibility:
#yum install compat-gcc-34-c++ compat-gcc-34
won't work for me as I'm running Ubuntu (On that note, I take it I can't simply install YUM and the subsequent package, since it's an entirely different distro, but if I'm wrong I'd love to hear it).
I instead installed two versions of gcc 3.4 - 3.4.0 and 3.4.6 using instructions from this site. I then added the lines suggested by that page to the top of the makefile (on this note, what's the difference between makefile and makefile.in? I tried adding the lines to the top of both files regardless), both for version 3.4.0 and 3.4.6, but both failed. I also tried, on the off-chance, compiling it with my current version (4.4.1), but that also failed. I got the errors:
(cd HTKLib && make HTKLib.a) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory `/home/charles/bin/htk-3.4/HTKLib'
gcc -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="i686"' -Wall -Wno-switch -g -O2 -I. -c -o HGraf.o HGraf.c
HGraf.c:73:77: error: X11/Xlib.h: No such file or directory
HGraf.c:74:23: error: X11/Xutil.h: No such file or directory
HGraf.c:75:21: error: X11/Xos.h: No such file or directory
HGraf.c:77:27: error: X11/keysymdef.h: No such file or directory
HGraf.c:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:88: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rootW’
HGraf.c:91: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘theCmap’
HGraf.c:92: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘theGC’
HGraf.c:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gcs’
HGraf.c:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘report’
HGraf.c:97: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘hints’
HGraf.c:111: error: ‘GXcopy’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXor’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXxor’ undeclared here (not in a function)
HGraf.c:111: error: ‘GXinvert’ undeclared here (not in a function)
HGraf.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c: In function ‘InstallFonts’:
HGraf.c:164: error: ‘FontInfo’ undeclared (first use in this function)
HGraf.c:164: error: (Each undeclared identifier is reported only once
HGraf.c:164: error: for each function it appears in.)
HGraf.c:164: warning: implicit declaration of function ‘XLoadQueryFont’
HGraf.c:164: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:167: error: ‘DefaultFont’ undeclared (first use in this function)
HGraf.c: At top level:
HGraf.c:176: error: expected ‘)’ before ‘*’ token
HGraf.c: In function ‘HGetEvent’:
HGraf.c:219: error: ‘XEvent’ undeclared (first use in this function)
HGraf.c:219: error: expected ‘;’ before ‘xev’
HGraf.c:223: warning: implicit declaration of function ‘XFlush’
HGraf.c:223: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:225: warning: implicit declaration of function ‘XEventsQueued’
HGraf.c:225: error: ‘QueuedAfterFlush’ undeclared (first use in this function)
HGraf.c:226: warning: implicit declaration of function ‘XNextEvent’
HGraf.c:226: error: ‘xev’ undeclared (first use in this function)
HGraf.c:228: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:230: error: ‘ButtonPress’ undeclared (first use in this function)
HGraf.c:235: error: ‘ButtonRelease’ undeclared (first use in this function)
HGraf.c:240: error: ‘MotionNotify’ undeclared (first use in this function)
HGraf.c:245: error: ‘KeyPress’ undeclared (first use in this function)
HGraf.c:249: warning: implicit declaration of function ‘DecodeKeyPress’
HGraf.c:251: error: ‘KeyRelease’ undeclared (first use in this function)
HGraf.c:257: error: ‘Expose’ undeclared (first use in this function)
HGraf.c: In function ‘HEventsPending’:
HGraf.c:281: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:281: error: ‘QueuedAfterFlush’ undeclared (first use in this function)
HGraf.c: In function ‘HMousePos’:
HGraf.c:288: error: ‘Window’ undeclared (first use in this function)
HGraf.c:288: error: expected ‘;’ before ‘root’
HGraf.c:293: warning: implicit declaration of function ‘XQueryPointer’
HGraf.c:293: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:293: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:293: error: ‘root’ undeclared (first use in this function)
HGraf.c:293: error: ‘child’ undeclared (first use in this function)
HGraf.c: In function ‘InstallColours’:
HGraf.c:311: error: ‘XColor’ undeclared (first use in this function)
HGraf.c:311: error: expected ‘;’ before ‘greyDef’
HGraf.c:317: warning: implicit declaration of function ‘XParseColor’
HGraf.c:317: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:317: error: ‘theCmap’ undeclared (first use in this function)
HGraf.c:317: error: ‘colourDef’ undeclared (first use in this function)
HGraf.c:320: warning: implicit declaration of function ‘XAllocColor’
HGraf.c:334: error: ‘whiteDef’ undeclared (first use in this function)
HGraf.c:334: warning: implicit declaration of function ‘XQueryColor’
HGraf.c:335: error: ‘blackDef’ undeclared (first use in this function)
HGraf.c:341: error: ‘greyDef’ undeclared (first use in this function)
HGraf.c: In function ‘HSetColour’:
HGraf.c:361: warning: implicit declaration of function ‘XSetForeground’
HGraf.c:361: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:361: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HSetGrey’:
HGraf.c:370: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:370: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawLines’:
HGraf.c:388: warning: implicit declaration of function ‘XDrawLines’
HGraf.c:388: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:388: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:388: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:388: error: ‘XPoint’ undeclared (first use in this function)
HGraf.c:388: error: expected expression before ‘)’ token
HGraf.c: In function ‘HDrawRectangle’:
HGraf.c:395: warning: implicit declaration of function ‘XDrawRectangle’
HGraf.c:395: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:395: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:395: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillRectangle’:
HGraf.c:402: warning: implicit declaration of function ‘XFillRectangle’
HGraf.c:402: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:402: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:402: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawLine’:
HGraf.c:408: warning: implicit declaration of function ‘XDrawLine’
HGraf.c:408: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:408: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:408: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillPolygon’:
HGraf.c:414: warning: implicit declaration of function ‘XFillPolygon’
HGraf.c:414: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:414: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:414: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:414: error: ‘XPoint’ undeclared (first use in this function)
HGraf.c:414: error: expected expression before ‘)’ token
HGraf.c: In function ‘HDrawArc’:
HGraf.c:427: warning: implicit declaration of function ‘XDrawArc’
HGraf.c:427: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:427: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:427: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFillArc’:
HGraf.c:440: warning: implicit declaration of function ‘XFillArc’
HGraf.c:440: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:440: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:440: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HPrintf’:
HGraf.c:451: warning: implicit declaration of function ‘XDrawString’
HGraf.c:451: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:451: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:451: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HCopyArea’:
HGraf.c:457: warning: implicit declaration of function ‘XCopyArea’
HGraf.c:457: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:457: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:457: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HPlotVector’:
HGraf.c:476: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:476: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:476: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HSetFontSize’:
HGraf.c:490: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c:490: error: ‘DefaultFont’ undeclared (first use in this function)
HGraf.c:499: error: ‘FontInfo’ undeclared (first use in this function)
HGraf.c:502: warning: implicit declaration of function ‘XSetFont’
HGraf.c:502: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:502: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘HSetLineWidth’:
HGraf.c:511: warning: implicit declaration of function ‘XSetLineAttributes’
HGraf.c:511: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:511: error: ‘gcs’ undeclared (first use in this function)
HGraf.c:511: error: ‘LineSolid’ undeclared (first use in this function)
HGraf.c:511: error: ‘JoinRound’ undeclared (first use in this function)
HGraf.c:511: error: ‘FillSolid’ undeclared (first use in this function)
HGraf.c: In function ‘HSetXMode’:
HGraf.c:517: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:517: error: ‘gcs’ undeclared (first use in this function)
HGraf.c: In function ‘CentreX’:
HGraf.c:523: warning: implicit declaration of function ‘XTextWidth’
HGraf.c:523: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘CentreY’:
HGraf.c:529: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HTextWidth’:
HGraf.c:535: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HTextHeight’:
HGraf.c:541: error: ‘CurrentFont’ undeclared (first use in this function)
HGraf.c: In function ‘HDrawImage’:
HGraf.c:550: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
HGraf.c:550: error: ‘xi’ undeclared (first use in this function)
HGraf.c:557: warning: implicit declaration of function ‘XDestroyImage’
HGraf.c:558: warning: implicit declaration of function ‘XGetImage’
HGraf.c:558: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:558: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:558: error: ‘AllPlanes’ undeclared (first use in this function)
HGraf.c:558: error: ‘XYPixmap’ undeclared (first use in this function)
HGraf.c:562: warning: implicit declaration of function ‘XPutPixel’
HGraf.c:564: warning: implicit declaration of function ‘XPutImage’
HGraf.c:564: error: ‘theGC’ undeclared (first use in this function)
HGraf.c: In function ‘HFlush’:
HGraf.c:570: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c: In function ‘InitGCs’:
HGraf.c:780: error: ‘XGCValues’ undeclared (first use in this function)
HGraf.c:780: error: expected ‘;’ before ‘values’
HGraf.c:783: error: ‘GCLineWidth’ undeclared (first use in this function)
HGraf.c:783: error: ‘GCFunction’ undeclared (first use in this function)
HGraf.c:783: error: ‘GCForeground’ undeclared (first use in this function)
HGraf.c:785: error: ‘values’ undeclared (first use in this function)
HGraf.c:788: error: ‘gcs’ undeclared (first use in this function)
HGraf.c:788: warning: implicit declaration of function ‘XCreateGC’
HGraf.c:788: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:788: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:790: error: ‘GCPlaneMask’ undeclared (first use in this function)
HGraf.c: In function ‘InitGlobals’:
HGraf.c:800: warning: implicit declaration of function ‘DefaultScreen’
HGraf.c:800: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:801: error: ‘theCmap’ undeclared (first use in this function)
HGraf.c:801: warning: implicit declaration of function ‘DefaultColormap’
HGraf.c:802: error: ‘rootW’ undeclared (first use in this function)
HGraf.c:802: warning: implicit declaration of function ‘RootWindow’
HGraf.c:803: error: ‘theGC’ undeclared (first use in this function)
HGraf.c:803: warning: implicit declaration of function ‘DefaultGC’
HGraf.c:804: error: ‘theVisual’ undeclared (first use in this function)
HGraf.c:804: warning: implicit declaration of function ‘DefaultVisual’
HGraf.c:805: warning: implicit declaration of function ‘DisplayCells’
HGraf.c:806: warning: implicit declaration of function ‘DisplayWidth’
HGraf.c:807: warning: implicit declaration of function ‘DisplayHeight’
HGraf.c:808: warning: implicit declaration of function ‘DisplayPlanes’
HGraf.c:809: warning: implicit declaration of function ‘WhitePixel’
HGraf.c:810: warning: implicit declaration of function ‘BlackPixel’
HGraf.c: In function ‘MakeXGraf’:
HGraf.c:817: error: ‘Window’ undeclared (first use in this function)
HGraf.c:817: error: expected ‘;’ before ‘window’
HGraf.c:818: error: ‘XSetWindowAttributes’ undeclared (first use in this function)
HGraf.c:818: error: expected ‘;’ before ‘setwinattr’
HGraf.c:823: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:823: warning: implicit declaration of function ‘XOpenDisplay’
HGraf.c:824: warning: implicit declaration of function ‘XDisplayName’
HGraf.c:828: error: ‘parent’ undeclared (first use in this function)
HGraf.c:829: error: ‘window’ undeclared (first use in this function)
HGraf.c:829: warning: implicit declaration of function ‘XCreateSimpleWindow’
HGraf.c:831: error: ‘CWBackingStore’ undeclared (first use in this function)
HGraf.c:831: error: ‘setwinattr’ undeclared (first use in this function)
HGraf.c:831: error: ‘WhenMapped’ undeclared (first use in this function)
HGraf.c:832: warning: implicit declaration of function ‘XChangeWindowAttributes’
HGraf.c:834: error: ‘hints’ undeclared (first use in this function)
HGraf.c:834: error: ‘PPosition’ undeclared (first use in this function)
HGraf.c:834: error: ‘PSize’ undeclared (first use in this function)
HGraf.c:834: error: ‘PMaxSize’ undeclared (first use in this function)
HGraf.c:834: error: ‘PMinSize’ undeclared (first use in this function)
HGraf.c:841: warning: implicit declaration of function ‘XSetStandardProperties’
HGraf.c:841: error: ‘None’ undeclared (first use in this function)
HGraf.c:843: warning: implicit declaration of function ‘XSelectInput’
HGraf.c:843: error: ‘ExposureMask’ undeclared (first use in this function)
HGraf.c:843: error: ‘KeyPressMask’ undeclared (first use in this function)
HGraf.c:843: error: ‘ButtonPressMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘ButtonReleaseMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘PointerMotionHintMask’ undeclared (first use in this function)
HGraf.c:844: error: ‘PointerMotionMask’ undeclared (first use in this function)
HGraf.c:845: warning: implicit declaration of function ‘XMapWindow’
HGraf.c:845: error: ‘theWindow’ undeclared (first use in this function)
HGraf.c:850: error: ‘report’ undeclared (first use in this function)
HGraf.c:851: error: ‘Expose’ undeclared (first use in this function)
HGraf.c:852: warning: implicit declaration of function ‘XSendEvent’
HGraf.c:852: error: ‘False’ undeclared (first use in this function)
HGraf.c: In function ‘TermHGraf’:
HGraf.c:861: error: ‘theDisp’ undeclared (first use in this function)
HGraf.c:862: warning: implicit declaration of function ‘XCloseDisplay’
make[1]: *** [HGraf.o] Error 1
make[1]: Leaving directory `/home/charles/bin/htk-3.4/HTKLib'
make: *** [HTKLib/HTKLib.a] Error 1
Thank you for any help you can provide.
The very first error may indicate the cause:
error: X11/Xlib.h: No such file or directory
At one time one needed to set $INCLUDE_PATH for gcc.
It looks to me that you are missing the X11 development packages.
So, the presence of a makefile.in indicates that the program is using autoconf. That being the case, I suggest you put both the makefile and makefile.in back the way they were, and instead redo the configure step:
GCC_VERSION=3.4.0 PREFIX=/usr/local/gcc/${GCC_VERSION}/bin/ CC=${PREFIX}gcc CPP=${PREFIX}g++ ./configure
Obviously, you should edit that to match the actual version of the compiler and path where you installed it, along with adding any extra configure arguments you need.
Are you sure you have the X11-devel package installed? Looks like an abject lack of X11 header files.
The first set of errors is
HGraf.c:73:77: error: X11/Xlib.h: No such file or directory
HGraf.c:74:23: error: X11/Xutil.h: No such file or directory
HGraf.c:75:21: error: X11/Xos.h: No such file or directory
HGraf.c:77:27: error: X11/keysymdef.h: No such file or directory
i.e. your compiler can't find the X11 headers. These will probably be somewhere like /usr/X11R6/include. Try adding that include path to your make command, like
make CFLAGS="$CFLAGS -I/usr/X11R6/include"
If the makefile is nonstandard you might have to edit it to insert this path. If you've run a configure script reconfigure with
./configure CFLAGS="$CFLAGS -I/usr/X11R6/include" # Include any other options
Install the gcc-3.4 from Ubuntu repos (sudo apt-get install gcc-4.3).
Then configure the project using ./configure CC="gcc-4.3" and make as usual.
This might not work, but point you in the right direction.
EDIT: The X11 development libraries on Ubuntu are named libx11-dev but they might not be the only development libraries you are missing: read the errors and try to guess what other libraries you are missing (if you note that a header is missing try searching http://packages.ubuntu.com for the file name and add the relative package using sudo apt-get install).

Resources