"linker' input unused when '-fsyntax-only' is present" on libClang - c

Has anyone experienced this sort of problem while attempting to running a executable generated by clang on a code using libclang (it occurs if I compile using gcc too)? Using few prints I noticed that it occurs on the following function call: fprintf(stderr, "%s\n", clang_getCString(String)); There is output from the Cstring in this case. I am compiling using Clang -lclang
Thanks.

Related

Gcc can't find Temp

I am a beginner and I use Gcc compiler. At least, I used, because it suddenly stopped working giving me this error
cc1: fatal error: cannot open '/c/Users/UTENTE~1/AppData/Local/Temp/cc8t2W16.s' for writing: No such file or directory
where "UTENTE" means "USER" and the .s file changes every time. This result is given to every code I tried to compile, the command was
gcc filename.c
and my OS is Windows. Can anyone help me? Maybe in really simple language, because I am very new...

Wrong compiler options accepted via Batch when compiling c code using Hightec compiler

I'm trying to compiler c code using Hightec compiler under win7 64bit operating system. Here is my sample Batch code for compiling:
Root\HightecInstall\bin\ppc-vle-gcc -fno-inline -c -o sample.o sample.c
This is only a sample code with the compiler options "-fno-inline". After I run the batch file, I got an error saying "unknown compiler options -no-inline". But what I input is "-fno-inline". So there is a missing letter "f". I have tried with other options and the output always gave me "unknown compiler options ***" which misses one or two letter at the beginning. For example. -DDefault -> unknown -efault. I don't really understand how that could happen and how could the compiler discard the first one or two letters. Does anyone have some suggestions? Thanks.
Bo

Why do I get a include <windows.h> error when developing on a Windows machine in C?

I am new to C and I am trying to compile a code that uses am external library. Therefore, I am following these steps for linking a library. But at the very first one
gcc -c -Wall -Werror -fpic PICASO_SERIAL_4DLIBRARY.C
I get this
PICASO_SERIAL_4DLIBRARY.C:1:0: error: -fpic ignored for target (all code is position independent) [-Werror]
#include <windows.h>
cc1plus.exe: all warning being treated as errors
additionally undder # there is a arrow above. I tried googling it but I could only find out that this is a Linux problem and not a Windows one (I am developing on Windows now) and the I followed these steps to install gcc. an compiling other small projects work, too.
Anyone any idea, why this doesn't work?
The mention of #include <windows.h> is incidental. That just happens to be the first line of code.
The compiler tries to associate a line of code with the error to help you find the problem. But in this case the code is irrelevant. The error is in the command line and you will get a failure no matter what the code is. But because the compiler is coded to always associate a line of code with an error, it decides, arbitrarily, to point the finger at the first line of code.
Because you use -Werror, warnings are treated as errors. The compiler therefore converts a warning about an ignored option to emit position independent code into an error. The error message states this very clearly:
PICASO_SERIAL_4DLIBRARY.C:1:0: error: -fpic ignored for target (all code is position independent) [-Werror]
I suspect you glazed over when reading the error message, and turned your attention to the line of code that was highlighted. Always read error messages carefully!
To resolve the error, remove the -fpic option from your command line.
Try to compile without -fpic. This flag is inappropriate for the mingw-w64 target.

linker error undefined symbol _log10f

I am using log10f function of math.h header file and I need to calculate log value in float that's why I use the above function
I am just posting the sample code instead of the actual code due to confidential information
#include<stdio.h>
#include<math.h>
void main(){
printf(" --->>> %f \n", log10f(4) - log10f(3));
}
Some how I am able to run that code in linux using gcc compiler with following command and it compiled properly and running properly
gcc Demo.c -lm -o Demo
./Demo
But I have to run the project on the windows too and I am using window 7 and turbo c but using tc my program compiled properly but at run time it showing me a LINKER ERROR UNDEFINED SYMBOL _LOG10F
Anyone have any Idea that how can I resolve this issue on Tc at windows.
Suggestions are most welcome thanks a lot in advance.
log10f was added to the C language 16 years ago. You are using a a compiler which is 25 years old, so it won't work.
A work-around might be to use log10 instead, which was available in the C90 standard. It uses double instead of float.

Combine C and TCL using Swig

I have been following a tutorial to combine C with TCL using Swig. The tutorial seemed to be properly working but at the end I ran into an error that I cannot solve. The situation is as follows:
The tutorial I was following is:
http://www.swig.org/tutorial.html.
I have a file named test.c:
char *HelloWorld()
{
return "hello world";
}
and another named test.i:
%module test
%{
/* Put header files here or function declarations like below */
extern char *HelloWorld();
%}
extern char *HelloWorld();
I then used the following command line arguments to ready the correct files:
gcc -c test.c -o test.o
swig -tcl test.i
gcc -c test_wrap.c -o test_wrap.o
gcc -dynamiclib -framework Tcl test.o test_wrap.o -o test.so
And finally I tried to load it using:
tclsh
% load test.so test
This is the point where I received the following error:
dlsym(0x100600090, Test_Unload): symbol not founddlsym(0x100600090, Test_SafeUnload): symbol not found
As far as I know I did not stray from the tutorial. Can anyone tell me how it is that I got this error and more importantly how to get rid of it?
Thanks in advance!
Are those error messages stopping the load from working? They shouldn't; they're reporting that the low-level API for supporting unloading of the extension isn't present, but that's OK (lots of extensions can't be unloaded; it's tricky to write code that supports it).
You don't mention exactly which version of Tcl you are using — but it must be at least 8.5 for those symbols to be even searched for in the first place — so it is a little hard to guess what the exact underlying issue is. (The message should simply not be reported.) I advise filing a bug report on this; make sure you include all exact versions in your report.
It's a long time since I used SWIG, so I'm not sure whether it gives you sufficient control over the code it generates for you to be able to apply this fix. Glossing over that detail, I can reproduce (and fix) the issue with the following:
In 'ext.c':
#include <tcl.h>
int DLLEXPORT Ext_Init(Tcl_Interp *interp) {
if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
return TCL_ERROR;
}
if (Tcl_PkgProvide(interp, "Ext", "0.0") == TCL_ERROR) {
return TCL_ERROR;
}
return TCL_OK;
}
Build, run tclsh, load extension:
$ gcc -dynamiclib -framework Tcl ext.c -o ext.so
$ tclsh8.5
% load ./ext.so
dlsym(0x400000, Ext_SafeInit): symbol not found
dlsym(0x400000, Ext_Unload): symbol not found
dlsym(0x400000, Ext_SafeUnload): symbol not found
Something internal to the library loading code is putting that error message into the interpreters result. To stop the message ever surfacing, set or reset the result so that the _Init() function ends with one or other of:
// Set the result to a message of your choosing
Tcl_SetObjResult(interp, Tcl_NewStringObj("ok", -1));
// Or clear out the result altogether
Tcl_ResetResult(interp);
return TCL_OK;
}
The init block feature of swig might insert code in the right place to achieve the same thing:
%init %{
Tcl_ResetResult(interp);
%}

Resources