That’s a good example of why you should upgrade to a new toolset: sscanf is a variadic function with a variable number of arguments. Older toolsets didn’t bother to do any analysis on the arguments while the newer ones interpret the format string the same way it would be interpreted at runtime and check if the arguments match. In your case they don’t because the ‘%’ sign looses it’s special function if it is escaped by another ‘%’ sign. VC19 is just trying to warn you about a probable bug in your code.
Not sure what you mean by changing only the debug source. There are however two problems with your format specifier:
- sscanf formats do not have a point for number of decimal places (unlike printf formats).
- percent sign must be escaped to read a percent sign from the input.
So, if you want to read something like "%12.34", the correct sscanf format is "%%%5f".
VS2019 warns you if you are missing the triple percent because the last argument of sscanf will not used.
I can only assume that eclipse is doing something. Normally, a header file that can't be found results in a fatal error. If you really are using #include "gtkmm.h", maybe eclipse is searching the project directory for the include file and that is what is generating the warning message. GCC/G++ on the other hand, searches the project directory and then the normal system directories for "" delimited include files Include Syntax (The C Preprocessor) If it is the case that you're using #include "gtkmm.h" try changing to #include <gtkmm.h>, and see if that removes the warning.
If it is the case that you're using #include "gtkmm.h" try changing to #include <gtkmm.h>, and see if that removes the warning.
I do not know how to enter greater / less then charactere here.
I did try #include <gtkmm.h> ( i just cut and paste your text ) with same result.
If you czech my next post you will find the answer - I am inclined to believe it is IDE problem.
After I did "new project" from scratch the build fails as expected when the file cannot be found.
This is just to keep the discussion going.
I did not verify this , but it looks as every time backtick string is added the build process has no error but the includes which cannot be satisfied are flagged as such in source file.
I am begging to question WHERE does the backtick string belong - as an option to complier or elsewhere?
I have used eclipse extensively in the past and it works fine. Your comment re double quotes versus angle brackets is correct. But that (and all the other issues) are nothing to do with eclipse, but about how the compiler search paths work.
SOLVED case closed
As expected - pkg-config DOES NOT integrate with just any Eclipse version / release.
I got it working as expected in 2018-09!
Sorry for wasting everybody time.
It is my understanding that the characters enclosed in backticks execute and the result is passed as option(s) to the GCC.
`pkg-config --cflags gtk+-3.0`
I have added the backticks string to both GCC compiler and linkers options and still getting the usual "undefined reference" error.
The tutorial does not explain much about implementing this backticks string.
(Should it add library -l refernces ??)
I woudl appreciate references or comments on this and suggestions how to actually resolve this issue.
I am enclosing the complier / liker verbose output for information, and I am sorry to take so much bandwidth with it.
I do not like blaming problems elsewhere, BUT,
this problem is really not related to using backtick syntax. After some trials it works as expected.
There were few other problems AFTER I updated to latest version of IDE. So I down paddled to previous, working release and imported the GTK project there.
Just build a clean GTK project and it works as expected.
I am sorry for wasting everybody time with a problem related to flaky IDE.
Thanks, but I know what is does - look at all the -I in the attached file. I think g++ also needs -l - libraries or library - for GTK.
But I am not sure how to do it if I need more.
Can I use similar method
as pkg-config to get -l /-L ?
OK, putting wrong option may be one of the issues.
I did put BOTH --cflag and --libs in complier and linker options. I also tried
this combined syntax
`pkg-config --cflags --libs gtk+-3.0`
The compiler and linker verbose outputs looks OK ( too big to repost here ) , BUT the unresolved error is apparently different issue.
I am enclosing what I posted in Eclipse forum here:
This error has been posted years ago and there was NO SOLUTION,
See this old post
[b]However, this only solved the issue of adding all the header files manually. Now I encounter errors like "Function 'G_CALLBACK' could not be resolved". I tried to compile my source-code (the first example of the GTK3 tutorial) in a terminal using the simple "gcc `pkg-config --cflags gtk+-3.0` -o example-0 First_GTK_test.cpp `pkg-config --libs gtk+-3.0`" command and it works. So the issue must be an Eclipse setting issue.[/b]
Every GTK tutorial is same - download / install GTK and run sample code in your editor...
It is up to the user to figure out how to option complier / linker to "include sources and link libraries"
Adding `pkg-config --cflags --libs gtk+-3.0` should work, I get expected verbose output , but it does not.
Even after that is done the compilation will fail because #include <gtk gtk.h=""> is unresolved.
Here is an output of whereis
z@z-desktop $ whereis gtk.h
Any help woudl be appreciated
End of Eclipse post.
I am really at lost where the reference
<gtk gtk.h=""> came from and unsure how to find gtk.h manually - where ?
How did you pick that up? I copied the entire output posted at the top of this thread, and
a) a search for "undefined" turned up nothing, and
b) as currently shown, the compile completes successfully!!
Doing a quick perusal of the rest of the thread, I didn't notice any further mention of exactly what was undefined.
At this point, I have no idea what the problem is, since it looks to me like the compile/link is correct - -lgtk-3 is in the link options. Maybe Eclipse is doing something odd.
#include /usr/include/gtk-3.0/gtk/gtk.h // edited so it show
int main (int argc, char *argv)
cout << "WINDOW sample code" << endl; // prints
/* Create the main, top level window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
And here is the tail of the compile / link process
./src/GTK_WIKI.o: In function `main':
/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2020_228/work_228/GTK_WIKI/Debug/../src/GTK_WIKI.cpp:49: undefined reference to `gtk_window_new'
collect2: error: ld returned 1 exit status
makefile:45: recipe for target 'GTK_WIKI' failed
make: *** [GTK_WIKI] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
I need to put code from my MFC app into a C++ app for iPad. And I have read a lot to figure out what should I use to develop such a thing. Can I call your experience in order to guide me what kind of framework to use for that ? I thought the shortest way is to use a virtual machine, but I don't think that it would be possible to use virtual machine on a iPad ...
I don't developed any app for MAC OS and any extra information regarding this is useful to me.