how to use a .c file to write a test class in google test instead of .cpp file?











up vote
0
down vote

favorite












I have used googletest for my Android NDK project contain .c files. I have used a test class of the type .cpp to do the same. I want to use .c file instead. I get the following error when I try to use it :



Running main() from gtest_main.cc
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (1 ms total)
[ PASSED ] 0 tests.


How can i solve this?










share|improve this question
























  • I don't understand. Why do you care whether your file has a .c or .cpp file-name extension? Why not just use the one that works and accurately describes the contents of the file?
    – Rob Kennedy
    May 14 '14 at 11:55












  • I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp , So wanted a way to run gtest using .c files
    – user3054298
    May 15 '14 at 3:50










  • So it is working fine only for some parts of my c code!
    – user3054298
    May 15 '14 at 4:12















up vote
0
down vote

favorite












I have used googletest for my Android NDK project contain .c files. I have used a test class of the type .cpp to do the same. I want to use .c file instead. I get the following error when I try to use it :



Running main() from gtest_main.cc
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (1 ms total)
[ PASSED ] 0 tests.


How can i solve this?










share|improve this question
























  • I don't understand. Why do you care whether your file has a .c or .cpp file-name extension? Why not just use the one that works and accurately describes the contents of the file?
    – Rob Kennedy
    May 14 '14 at 11:55












  • I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp , So wanted a way to run gtest using .c files
    – user3054298
    May 15 '14 at 3:50










  • So it is working fine only for some parts of my c code!
    – user3054298
    May 15 '14 at 4:12













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have used googletest for my Android NDK project contain .c files. I have used a test class of the type .cpp to do the same. I want to use .c file instead. I get the following error when I try to use it :



Running main() from gtest_main.cc
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (1 ms total)
[ PASSED ] 0 tests.


How can i solve this?










share|improve this question















I have used googletest for my Android NDK project contain .c files. I have used a test class of the type .cpp to do the same. I want to use .c file instead. I get the following error when I try to use it :



Running main() from gtest_main.cc
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (1 ms total)
[ PASSED ] 0 tests.


How can i solve this?







c++ c unit-testing googletest






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 14 '14 at 11:12









Mike Kinghan

29.4k762107




29.4k762107










asked May 14 '14 at 5:49









user3054298

3817




3817












  • I don't understand. Why do you care whether your file has a .c or .cpp file-name extension? Why not just use the one that works and accurately describes the contents of the file?
    – Rob Kennedy
    May 14 '14 at 11:55












  • I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp , So wanted a way to run gtest using .c files
    – user3054298
    May 15 '14 at 3:50










  • So it is working fine only for some parts of my c code!
    – user3054298
    May 15 '14 at 4:12


















  • I don't understand. Why do you care whether your file has a .c or .cpp file-name extension? Why not just use the one that works and accurately describes the contents of the file?
    – Rob Kennedy
    May 14 '14 at 11:55












  • I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp , So wanted a way to run gtest using .c files
    – user3054298
    May 15 '14 at 3:50










  • So it is working fine only for some parts of my c code!
    – user3054298
    May 15 '14 at 4:12
















I don't understand. Why do you care whether your file has a .c or .cpp file-name extension? Why not just use the one that works and accurately describes the contents of the file?
– Rob Kennedy
May 14 '14 at 11:55






I don't understand. Why do you care whether your file has a .c or .cpp file-name extension? Why not just use the one that works and accurately describes the contents of the file?
– Rob Kennedy
May 14 '14 at 11:55














I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp , So wanted a way to run gtest using .c files
– user3054298
May 15 '14 at 3:50




I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp , So wanted a way to run gtest using .c files
– user3054298
May 15 '14 at 3:50












So it is working fine only for some parts of my c code!
– user3054298
May 15 '14 at 4:12




So it is working fine only for some parts of my c code!
– user3054298
May 15 '14 at 4:12












1 Answer
1






active

oldest

votes

















up vote
7
down vote



accepted










You cannot use a .c file to write a test class in googletest instead of a .cpp file.



A .c file should contain C language source code and a C/C++ compiler will assume that a .c file
is to be compiled as C.



A .cpp file should contain C++ language source code and a C/C++ compiler will assume that a .cpp file
is to be compiled as C++.



C and C++ are related but different programming languages. C is much older and simpler than C++.
There are no classes in the C language. C++ source code containing classes cannot be compiled as C.



Googletest is a unit-testing framework that is written in C++, not C, and it requires you to write
your test code in C++, using the framework classes. Your tests must coded in .cpp (and .h) files so that
the compiler will compile them as C++.



However, you can use googletest to unit-test C code. The C code will be in .c and .h files, but you
have to code your unit-tests, as usual, in .cpp and .h files. The C/C++ compiler knows that
the .c files are to be compiled as C and the .cpp files are to be compiled as C++.



There is a small complication that you must deal with when you want to #include "some_header.h"
in your C++ unit-test code, and some_header.h is one of the C-language header files:



The C++ compiler is going to process some_header.h, and it can process it correctly as long
as it knows that
some_header.h is a C-language header file. To inform the C++ compiler that some_header.h
is a C header, you write this:



extern "C" {
#include "some_header.h"
}


If you don't put extern "C" { ... } around the #include for a C-language header then you will get undefined-symbol
errors at linktime.



I suggest that you experiment with a project containing the following three files:



return_one.h



// return_one.h
#ifndef RETURN_ONE_H
#define RETURN_ONE_H

// A C library :)

// A C function that always return 1.
extern int return_one(void);

#endif


return_one.c



// return_one.c
#include "return_one.h"

int return_one(void)
{
return 1;
}


test_return_one.cpp



// test_return_one.cpp
#include "gtest/gtest.h"
extern "C" {
#include "return_one.h"
}

TEST(t_return_one, returns_1)
{
EXPECT_EQ(1,return_one());
}

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


Get this project to compile, link and run with googletest.



You may find the answers to this question helpful.






share|improve this answer























  • When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
    – user3054298
    May 15 '14 at 3:39












  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
    – user3054298
    May 15 '14 at 3:48










  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
    – user3054298
    May 15 '14 at 3:49










  • @user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
    – Mike Kinghan
    May 17 '14 at 15:12










  • The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
    – user3054298
    May 22 '14 at 10:52











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23646595%2fhow-to-use-a-c-file-to-write-a-test-class-in-google-test-instead-of-cpp-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
7
down vote



accepted










You cannot use a .c file to write a test class in googletest instead of a .cpp file.



A .c file should contain C language source code and a C/C++ compiler will assume that a .c file
is to be compiled as C.



A .cpp file should contain C++ language source code and a C/C++ compiler will assume that a .cpp file
is to be compiled as C++.



C and C++ are related but different programming languages. C is much older and simpler than C++.
There are no classes in the C language. C++ source code containing classes cannot be compiled as C.



Googletest is a unit-testing framework that is written in C++, not C, and it requires you to write
your test code in C++, using the framework classes. Your tests must coded in .cpp (and .h) files so that
the compiler will compile them as C++.



However, you can use googletest to unit-test C code. The C code will be in .c and .h files, but you
have to code your unit-tests, as usual, in .cpp and .h files. The C/C++ compiler knows that
the .c files are to be compiled as C and the .cpp files are to be compiled as C++.



There is a small complication that you must deal with when you want to #include "some_header.h"
in your C++ unit-test code, and some_header.h is one of the C-language header files:



The C++ compiler is going to process some_header.h, and it can process it correctly as long
as it knows that
some_header.h is a C-language header file. To inform the C++ compiler that some_header.h
is a C header, you write this:



extern "C" {
#include "some_header.h"
}


If you don't put extern "C" { ... } around the #include for a C-language header then you will get undefined-symbol
errors at linktime.



I suggest that you experiment with a project containing the following three files:



return_one.h



// return_one.h
#ifndef RETURN_ONE_H
#define RETURN_ONE_H

// A C library :)

// A C function that always return 1.
extern int return_one(void);

#endif


return_one.c



// return_one.c
#include "return_one.h"

int return_one(void)
{
return 1;
}


test_return_one.cpp



// test_return_one.cpp
#include "gtest/gtest.h"
extern "C" {
#include "return_one.h"
}

TEST(t_return_one, returns_1)
{
EXPECT_EQ(1,return_one());
}

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


Get this project to compile, link and run with googletest.



You may find the answers to this question helpful.






share|improve this answer























  • When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
    – user3054298
    May 15 '14 at 3:39












  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
    – user3054298
    May 15 '14 at 3:48










  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
    – user3054298
    May 15 '14 at 3:49










  • @user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
    – Mike Kinghan
    May 17 '14 at 15:12










  • The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
    – user3054298
    May 22 '14 at 10:52















up vote
7
down vote



accepted










You cannot use a .c file to write a test class in googletest instead of a .cpp file.



A .c file should contain C language source code and a C/C++ compiler will assume that a .c file
is to be compiled as C.



A .cpp file should contain C++ language source code and a C/C++ compiler will assume that a .cpp file
is to be compiled as C++.



C and C++ are related but different programming languages. C is much older and simpler than C++.
There are no classes in the C language. C++ source code containing classes cannot be compiled as C.



Googletest is a unit-testing framework that is written in C++, not C, and it requires you to write
your test code in C++, using the framework classes. Your tests must coded in .cpp (and .h) files so that
the compiler will compile them as C++.



However, you can use googletest to unit-test C code. The C code will be in .c and .h files, but you
have to code your unit-tests, as usual, in .cpp and .h files. The C/C++ compiler knows that
the .c files are to be compiled as C and the .cpp files are to be compiled as C++.



There is a small complication that you must deal with when you want to #include "some_header.h"
in your C++ unit-test code, and some_header.h is one of the C-language header files:



The C++ compiler is going to process some_header.h, and it can process it correctly as long
as it knows that
some_header.h is a C-language header file. To inform the C++ compiler that some_header.h
is a C header, you write this:



extern "C" {
#include "some_header.h"
}


If you don't put extern "C" { ... } around the #include for a C-language header then you will get undefined-symbol
errors at linktime.



I suggest that you experiment with a project containing the following three files:



return_one.h



// return_one.h
#ifndef RETURN_ONE_H
#define RETURN_ONE_H

// A C library :)

// A C function that always return 1.
extern int return_one(void);

#endif


return_one.c



// return_one.c
#include "return_one.h"

int return_one(void)
{
return 1;
}


test_return_one.cpp



// test_return_one.cpp
#include "gtest/gtest.h"
extern "C" {
#include "return_one.h"
}

TEST(t_return_one, returns_1)
{
EXPECT_EQ(1,return_one());
}

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


Get this project to compile, link and run with googletest.



You may find the answers to this question helpful.






share|improve this answer























  • When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
    – user3054298
    May 15 '14 at 3:39












  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
    – user3054298
    May 15 '14 at 3:48










  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
    – user3054298
    May 15 '14 at 3:49










  • @user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
    – Mike Kinghan
    May 17 '14 at 15:12










  • The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
    – user3054298
    May 22 '14 at 10:52













up vote
7
down vote



accepted







up vote
7
down vote



accepted






You cannot use a .c file to write a test class in googletest instead of a .cpp file.



A .c file should contain C language source code and a C/C++ compiler will assume that a .c file
is to be compiled as C.



A .cpp file should contain C++ language source code and a C/C++ compiler will assume that a .cpp file
is to be compiled as C++.



C and C++ are related but different programming languages. C is much older and simpler than C++.
There are no classes in the C language. C++ source code containing classes cannot be compiled as C.



Googletest is a unit-testing framework that is written in C++, not C, and it requires you to write
your test code in C++, using the framework classes. Your tests must coded in .cpp (and .h) files so that
the compiler will compile them as C++.



However, you can use googletest to unit-test C code. The C code will be in .c and .h files, but you
have to code your unit-tests, as usual, in .cpp and .h files. The C/C++ compiler knows that
the .c files are to be compiled as C and the .cpp files are to be compiled as C++.



There is a small complication that you must deal with when you want to #include "some_header.h"
in your C++ unit-test code, and some_header.h is one of the C-language header files:



The C++ compiler is going to process some_header.h, and it can process it correctly as long
as it knows that
some_header.h is a C-language header file. To inform the C++ compiler that some_header.h
is a C header, you write this:



extern "C" {
#include "some_header.h"
}


If you don't put extern "C" { ... } around the #include for a C-language header then you will get undefined-symbol
errors at linktime.



I suggest that you experiment with a project containing the following three files:



return_one.h



// return_one.h
#ifndef RETURN_ONE_H
#define RETURN_ONE_H

// A C library :)

// A C function that always return 1.
extern int return_one(void);

#endif


return_one.c



// return_one.c
#include "return_one.h"

int return_one(void)
{
return 1;
}


test_return_one.cpp



// test_return_one.cpp
#include "gtest/gtest.h"
extern "C" {
#include "return_one.h"
}

TEST(t_return_one, returns_1)
{
EXPECT_EQ(1,return_one());
}

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


Get this project to compile, link and run with googletest.



You may find the answers to this question helpful.






share|improve this answer














You cannot use a .c file to write a test class in googletest instead of a .cpp file.



A .c file should contain C language source code and a C/C++ compiler will assume that a .c file
is to be compiled as C.



A .cpp file should contain C++ language source code and a C/C++ compiler will assume that a .cpp file
is to be compiled as C++.



C and C++ are related but different programming languages. C is much older and simpler than C++.
There are no classes in the C language. C++ source code containing classes cannot be compiled as C.



Googletest is a unit-testing framework that is written in C++, not C, and it requires you to write
your test code in C++, using the framework classes. Your tests must coded in .cpp (and .h) files so that
the compiler will compile them as C++.



However, you can use googletest to unit-test C code. The C code will be in .c and .h files, but you
have to code your unit-tests, as usual, in .cpp and .h files. The C/C++ compiler knows that
the .c files are to be compiled as C and the .cpp files are to be compiled as C++.



There is a small complication that you must deal with when you want to #include "some_header.h"
in your C++ unit-test code, and some_header.h is one of the C-language header files:



The C++ compiler is going to process some_header.h, and it can process it correctly as long
as it knows that
some_header.h is a C-language header file. To inform the C++ compiler that some_header.h
is a C header, you write this:



extern "C" {
#include "some_header.h"
}


If you don't put extern "C" { ... } around the #include for a C-language header then you will get undefined-symbol
errors at linktime.



I suggest that you experiment with a project containing the following three files:



return_one.h



// return_one.h
#ifndef RETURN_ONE_H
#define RETURN_ONE_H

// A C library :)

// A C function that always return 1.
extern int return_one(void);

#endif


return_one.c



// return_one.c
#include "return_one.h"

int return_one(void)
{
return 1;
}


test_return_one.cpp



// test_return_one.cpp
#include "gtest/gtest.h"
extern "C" {
#include "return_one.h"
}

TEST(t_return_one, returns_1)
{
EXPECT_EQ(1,return_one());
}

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


Get this project to compile, link and run with googletest.



You may find the answers to this question helpful.







share|improve this answer














share|improve this answer



share|improve this answer








edited May 23 '17 at 11:58









Community

11




11










answered May 14 '14 at 10:51









Mike Kinghan

29.4k762107




29.4k762107












  • When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
    – user3054298
    May 15 '14 at 3:39












  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
    – user3054298
    May 15 '14 at 3:48










  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
    – user3054298
    May 15 '14 at 3:49










  • @user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
    – Mike Kinghan
    May 17 '14 at 15:12










  • The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
    – user3054298
    May 22 '14 at 10:52


















  • When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
    – user3054298
    May 15 '14 at 3:39












  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
    – user3054298
    May 15 '14 at 3:48










  • When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
    – user3054298
    May 15 '14 at 3:49










  • @user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
    – Mike Kinghan
    May 17 '14 at 15:12










  • The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
    – user3054298
    May 22 '14 at 10:52
















When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
– user3054298
May 15 '14 at 3:39






When I try to include only my header file and not the .c file which is to be tested , error: undefined reference to '__FreeRetransmitterQueue' collect2: ld returned 1 exit status make.exe: *** [obj/local/armeabi/SmartTest] Error 1
– user3054298
May 15 '14 at 3:39














When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
– user3054298
May 15 '14 at 3:48




When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2'
– user3054298
May 15 '14 at 3:48












When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
– user3054298
May 15 '14 at 3:49




When I include my .c file , I get certain compilation issues which is unable to recognize the type conversions error: cannot convert 'MyVersion {aka tagMYVersion}' to 'MyStatus' for argument '2' There are no such compilation issues when I run ndk-build alone for the project / when I compile my source code in a .c file instead of .cpp
– user3054298
May 15 '14 at 3:49












@user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
– Mike Kinghan
May 17 '14 at 15:12




@user3054298 Sorry, I cannot understand what you are trying to say. It might help if you posted "my .c file" and the compiler commandline that produces the errors.
– Mike Kinghan
May 17 '14 at 15:12












The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
– user3054298
May 22 '14 at 10:52




The issue i was facing was that implicit type conversions are not recognized in C++ compiler , ..so i had to modify my .c files and use explicit type casting every where. Any way to solve this issue without changing source code? thx for ur help
– user3054298
May 22 '14 at 10:52


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23646595%2fhow-to-use-a-c-file-to-write-a-test-class-in-google-test-instead-of-cpp-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?