DpinkyandDbrain's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 40 (0.03 per day)
- Joined:
- 09-March 10
- Profile Views:
- 1,008
- Last Active:
Apr 22 2013 11:21 AM- Currently:
- Offline
Previous Fields
- Country:
- US
- OS Preference:
- Linux
- Favorite Browser:
- FireFox
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Playstation
- Your Car:
- Subaru
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Is there a easy way to make a simple text editor?
Posted 12 Jul 2012
A fair amount, I would like this to happen any suggestions?
-DpDb -
In Topic: Problem: Calling C++ in C
Posted 26 Apr 2012
Wow thank you baavgai that was very helpful. So, I guess I was wrong in assuming I needed a header file in linking C++ with C. Was I right in assuming C can only be correctly linked to the correct libs with gcc? and what is the test file is in an output file or an object file? If I'm basically concatenating two different object files into test. Or, am I complete wrong in thinking that.
DpDb -
In Topic: Problem: Calling C++ in C
Posted 26 Apr 2012
Can you not compile C code with g++ as well just have linking issues with not getting the correct C libs? I thought that was the difference.
and here is my current C code:
#include "callHello.h" #include <stdio.h> //extern "C" const char* sayingHello(); int main(void){ sayingHello(); printf("this is the programming language C"); return 0; }
and the header file callHello.h:
#ifndef _callHello #define _callHello #ifdef __cplusplus extern "C"{ #endif void sayingHello(); #ifdef __cplusplus } #endif #endif /*callHello wrapper*/ -
In Topic: Problem: Calling C++ in C
Posted 26 Apr 2012
current C++ code:
#include "callHello.h" #include <iostream> using namespace std; //public: extern "C"{ void sayingHello(){ cout << "Hello from the C++ Language - Hello!!"; //return "Hello from the C++ Language - Hello!!"; } }
commandline:
$ g++ -c callHello.cpp $ ar rvs callHello.a callHello.o $ g++ call.c -l callHello.a call.c: In function ‘int main()’: call.c:8: error: ‘sayingHello’ was not declared in this scope
The C header file and the C file have not changed
DpDb -
In Topic: Problem: Calling C++ in C
Posted 26 Apr 2012
and yeah I don't know what I was thinking when I was trying to make a class there. Guess I was grabbing at straws.
DpDb
I believed that if I compiled call.c with g++ it would not link the proper C libs aka stdio.h guess that was a bad assumption.
DpDb
So I removed my naive approach to putting my extern C inside of a class and it compiled fine. But now I get this:
$g++ call.c -l callHello.a
call.c: In function ‘int main()’:
call.c:8: error: ‘sayingHello’ was not declared in this scope
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
Contact Information
- E-mail:
- Click here to e-mail me
Friends
DpinkyandDbrain hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
harmeet.kaur08
22 Aug 2010 - 10:10what are the guidelines to specify which column is to be indexed in a table.