Unsolved :-1: error: symbol(s) not found for architecture x86_64
-
@Dhara I don't know whether it is related, but why do you have these lines in your pro file:
stdlib -=libc++ stdlib -=libstdc++
You should try a simple project with unit tests to be sure it is working in general.
-
@jsulm @SGaist The issue was with diff arguments being passed. I cannot modify the test case which passes char * to QCOMPARE, but i dont know how to make a char * value be returned from a function using a string*, in other words i would like to convert string * to char * and without the const issues. How should i do that ?
-
-
@jsulm Yes, but this would touch the unit test, i have been given conditions not to change the unit test.
-
@Dhara I don't know your requirements, but actually tests should be adapted to production code not other way around.
Alternative would be to return char* instead of a string, but I never would do this just because unit tests would like to have it this way. -
@jsulm your point is true, but what about the TDD approach ?
-
@jsulm : another question if you could assist please, i get this error now :
duplicate symbol _main in: test_user.o test_group.o
-
@Dhara said in :-1: error: symbol(s) not found for architecture x86_64:
_main
it means that what ever _main is, its include in both
test_user and test_groupThis often happens if its a variable and its define in .h file.
So what is _main ?
function / variable ? -
@mrjj there is no variable named _main or even a function named that. i do have one main.cpp file.
-
@Dhara
Did you move the main function or anything like that?
Try to delete the build folder and run qmake+build all.
Just to be sure all .o is created fresh. -
There's no such restriction in TDD.
In TDD, the goal is to have your code tested all along, not that the tests are written in stones and that you should workaround them in your production code.
If a function needs to have its signature changed, then update the test so you can validate the new version of that function.
-
-
I now get :
Undefined symbols for architecture x86_64: "contact::setName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from: group::group(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in group.o
Any suggestions?
-
Thanks alot for the help that you have been giving me. I managed to fix all the issues and also the duplicate error meant that i had to create two subprojects for both the test cases, i have no clue what was repeating but doing this solved the issue.
I updated the test cases too so that they would match QCOMPARE's definition.
I also deleted std -= libc++ and the other line and also removed C++11 config line too. Removing these lines did not harm the project.
-
Hi,
@Dhara
please move it solved state if u have the got solution and post ur solution so others will be helped from ur answer.Thanks,
-
@Dhara same issue exist for me too