This is my first message on this forum… so hello at all..
I have to make c++ project with Eclipse IDE and using QT library… and I want to integrate QT library…
So I have downloaded Eclipse and QT version 5.1.0, included the library and all work…My problem born when I try to integrate qmake in eclipse for using moc compiler… I followed this procedure www.qtcentre.org/wiki/index.php?title=How_to_use_Eclipse_with_Qt4_in_10_steps.. but doesn't work…
Could someone help me?
Thanks
Sorry. I try to explain better the problem...
After installing eclipse with O.S. windows I have created a new project:
1) File->new->c++ Project (inserted the project name) and selected MinGW GCC as toolchains and debug and release as configurations
2)Project->Properties-> C/C++ Build->Settings->GCC C++ Compiler->Includes .. I included the path of may Qt library
3)Project->Properties-> C/C++ Build->Settings->MinGW C++ Linker-> LIbraries I included the link to the libraries.
4)I have created my file project called main.cpp and the header and cpp for my class (testclass1.h testclass1.cpp)
5) My class is a deriverd class of QObject and since I have to use signal and slot I need of Q_OBJECT macro.
6) Run->External ToolsConfigrations I created two new Programs.
.Name:Qmake
.Location .../bin/qmake
.Name:QtAssistant
.Location .../bin/assistant
7)Created a new target in my "Make target"
Target Name: qmake
Make Target: myQtProj.pro
Build Command: qmake
Target Name: all
Make Target: all
Build Command: default (make)
8) when I run qmake I have this error: undefined reference to `vtable for testclass1..I thinks that this depends on the macro Q_OBJECT.. I expect that running qmake the moc compiler is called so I should have in testclass1.cpp the macro Q_OBJECT "expanded"..
At the moment I solved the problem in this manner(from command line I called):
qmake -project (create myproject.pro)
qmake (create a makefile)
mingw32-make that create moc_testclass1.cpp...
So I copy the content of moc_testclass1.cpp in my testclass1... and I can build the project and all work. But this is not and automated way..
I hope to be more clear in my description.
Thanks for your help.
Related
I fail to link the pistache library in Eclipse C++ on my Ubuntu machine. I already make this reference:
Properties > C/C++ Build > Settings > Tool Settings
Under GCC C++ Linker > Libraries > Library search path
Under GCC C++ Compiler > Includes > Include paths
Add /usr/local/include/pistache to each
It throws a bunch of errors like this:
.... undefined reference to `Pistache::Ipv4::any()'
Why does this fail? The autocomplete is able to see the reference when I try rewrite the whole line, but it still errors out.
You have to let the linker use shared libraries and pass the -fpic option to the compiler:
a. First step -shared, see this image
b. Last Step Position Independent Code -fPic, see this image
Update
Another way to solve this is:
a. Add support for pthread to the linker
b.Add pistache to libraries in the linker
I am using the Gradle J2ObjC plugin to translate Java code in the pure-Java modules of my project to Objective-C. I have a need for the generated podspec file in the build/j2objcOutputs folder of one of my Java modules to contain a junit entry in the spec.libraries list. Currently it is defined as follows:
spec.libraries = 'ObjC', 'guava', 'javax_inject', 'jre_emul', 'jsr305', 'z', 'icucore'
Is there something that I can add to the build.gradle file of my Java module to make this possible?
I have been unable to figure out how to do this with the J2Objc Gradle plugin and have had to resort to putting the following in the "Other linker flags" in Xcode for my tests target:
$(inherited)
-l"junit"
I'm marking this as the solution until someone can suggest otherwise.
Been trying to use log4c in an eclipse IDE. No matter what I try, I can't seem to resolve the __log4c_category_vlog reference in my link.
I can see __log4c_category_vlog via an objdump of the liblog4c.a file, I've tried modifying some of the code in the category.c/category.h files before I do the make/make install, all to no avail. I've set my linker to point to the proper lib64 folder, added proper include etc in Eclipse.
The sample programs that come with log4c compile/link/run ok, so I must be missing something obvious. Any help/heads up appreciated!
log4c version:1.2.4
Eclipse version:luna
Linux: Opensuse 13.2
gcc version: 4.8.3 20140627
/home/david/build3/include/log4c/category.h:359: undefined reference to __log4c_category_vlog'
makefile:30: recipe for target 'testLog4c' failed
./src/testLog4c.o: In functionlog4c_category_log':
I am running Ubuntu 64bit version, and downloaded the latest 64bit Eclipse.
Installed g++ along with build-essential. Tested g++ to make sure it works from terminal, and it works fine.
alex#ubuntu:~/Desktop$ g++ test.cpp -o test
alex#ubuntu:~/Desktop$ ./test
Hello World!alex#ubuntu:~/Desktop$
However, trying to build simple C++ Hello Word project(one of the default projects that comes with Eclipse), I am getting error.
Description Resource Path Location Type
Program "g++" not found in PATH Preferences, C++/Build/Settings/Discovery, [CDT GCC Builtin Compiler Settings] options C/C++ Scanner Discovery Problem
I have added Environment variable named g++ with value /usr/bin/g++ and the above error went away, however, now I am getting unresolved errors, though project compiles and in the Console shows !!!Hello World!!!
Description Resource Path Location Type
Symbol 'endl' could not be resolved test_hello.cpp /test_hello/src line 13 Semantic Error
Symbol 'cout' could not be resolved test_hello.cpp /test_hello/src line 13 Semantic Error
Symbol 'std' could not be resolved test_hello.cpp /test_hello/src line 10 Semantic Error
Have I correctly entered Environmental variable ?? How can I get fix the "unresolved" error ?? Thanks !
When compiling there are two important things to consider:
1.) Is my path up-to-date with executables?
2.) Is my library path correct?
It appears you satisfy 1.) but not 2.)
The unresolved symbol error means that Eclipse cannot find your library via LD_LIBRARY_PATH or some other medium. It's attempting to locate the standard compiled C++ library.
How did you install g++?
Kindly do this and post the results:
Project > Properties > C/C++ Build > Environment
If everything there appears nominal, you can try
/sbin/ldconfig
which should hopefully re-parse your system library paths and might update your environment.
This feels silly, but its been 2 days...somewhere after upgrading from Ubuntu 10.04 to 10.11 and from Eclipse Helios to Eclipse Indigo, I got stuck with the following problem:
Problem Description:
I'm trying to use a function in math.h called isinf(), but the problem also occurs with things like isnan(). The program compiles fine on the command line using make and fine in eclipse using build. But if I open the program file in eclipse it reports that it cannot reolve the isinf() function call. If I just insert the program contents into a new project and new source file, the error appears immediately. This problem did not occur under 11.04 with Eclipse Helios CDT
Questions:
Why are these errors only reported when the program file is opened and not on when the program is compiled; why are the errors not detected make is run from the command line? Is there a solution/workaround available?
Version Info
Linux Ubuntu 10.11 64-bit
Eclipse CDT Indigo, Service Release 1, Build id: 20110916-0149
(Also using Eclipse EE Indigo – if that makes a difference)
GNU Make 3.81
gcc 4.6.1-9Ubuntu3
To Duplicate:
Please find the two files you'll need to replicate below:
Step 0. Verify that everything is fine outside of Eclipse
Copy the attached source file and make file
create a directory e.g. Mkdir FunTest
Save the source file a 'Test.cpp' and the makefile as 'makefile'
Open a command prompt and navigate to the directory e.g. FunTest
Enter 'make'
Enter ./TestOut
Program responds “is not infinite”
Step 1. Create the project in Eclipse
Open Eclipse
Select File|New|MakeFile Project with Existing Code
Click Browse – navigate to the directory (FunTest) and click ok
Select 'Linux GCC' from the Toolchain selector
Click Finish
Step 2. Find the Error
Click Build All (Ctrl-B) – project builds without errors
Open the project in the project explorer to display the file in the directory
Double click on the file “Test.cpp”
Note the error icon next to line testing for infinity
Note the 2 error messages:
Semantic error: Function _isinff could not be resolved
Semantic error: Function _isinfl could not be resolved
Test.cpp:
include <math.h>
int main(int argc, char **argv)
{
int TestNum = 10;
if (isinf(TestNum) == 0)
printf("Not infinite\n");
return 0;
}
makefile:
# Specify the compiler
CC = g++
# Specify the compiler flags
CFLAGS += -c
# Specify the files making up the application
SOURCES = Test.cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = TestOut
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $#
.cpp.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $< -o $#
install:
#echo "Build complete!"
I have experienced similar problems of the CDT reporting errors even though the code compiled fine within Eclipse Indigo.
Project > Properties > Settings > Binary Parsers > "GNU Elf Parser"
helped in my case. I had the "Elf Parser" checked.
That looks like a problem that many others have had with eclipse CDT before. Sometimes shutting eclipse down and then starting it back up again is enough to help. If that isn't the case, take a look at what I have below:
Compilation ok, but eclipse content assist having problems
Check your includes: if you're using include<math.h> change it to include<cmath>. The same for stdio.h and stdlib.h, you should replace by cstdio and cstdlib. Another option may be change you project to a C project instead of a C++.
You are missing -lm option in your build preferences.
Project->Properties->Settings->Miscleanous->Other (linker) flags[]
For me, it was solved by adding a specific ‘Source Location’ folder, and removing the default. In Luna, it is under:
Project > Properties > C/C++ General > Paths and Symbols > Source
Location