Go to Post When more STEM teams exist outside schools than in them, that will be one indication that a true cultural change has occurred. - gblake [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 25-01-2010, 21:44
nabioullinr nabioullinr is offline
Registered User
FRC #1073
 
Join Date: Jan 2010
Location: Hollis, NH
Posts: 17
nabioullinr has a spectacular aura aboutnabioullinr has a spectacular aura aboutnabioullinr has a spectacular aura about
Re: Cannot Mix C Code

Quote:
/* ScriptParser.cpp*/
#include <string>
#include <cstdio>
#include "ScriptParser.h"
extern "C" {
#include "tiny_scheme_interpreter.h"
}

bool ScriptParser::init(string initFile) {
FILE *fscript;

printf("Initializing TinyScheme...");
scheme_init(&sc);
puts("Done");
...
}
Code:
/* tiny_scheme_interpreter.h */
...
int scheme_init(scheme *sc);
...
Code:
/* tiny_scheme_interpreter.c */
...
int scheme_init(scheme *sc) {
 return scheme_init_custom_alloc(sc,malloc,free);
}
...
I checked the build properties and found that .c and .cpp files are compiled with the same flags but a different variable/macro is used (%ccompilerprefix% and %cppcompilerprefix%) in the command.
Code:
echo "building $@";%ccompilerprefix% $(TOOL_PATH)ccppc %DebugModeFlags% %ToolFlags% $(ADDED_CFLAGS) %Includes% $(ADDED_INCLUDES) -DCPU=$(CPU) -DTOOL_FAMILY=$(TOOL_FAMILY) -DTOOL=$(TOOL) -D_WRS_KERNEL   $(DEFINES) -o %OutFile% -c %InFile%

$(CC_ARCH_SPEC) -ansi  -Wall  -MD -MP -mlongcall
Code:
echo "building $@";%cppcompilerprefix% $(TOOL_PATH)ccppc %DebugModeFlags% %ToolFlags% $(ADDED_CFLAGS) %Includes% $(ADDED_INCLUDES) -DCPU=$(CPU) -DTOOL_FAMILY=$(TOOL_FAMILY) -DTOOL=$(TOOL) -D_WRS_KERNEL   $(DEFINES) -o %OutFile% -c %InFile%

$(CC_ARCH_SPEC) -ansi  -Wall  -MD -MP -mlongcall
I checked the console output and the function definitely seemed mangled...any ideas on howto change compilation to C?

Last edited by nabioullinr : 25-01-2010 at 21:49.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot deploy code Patrick Chiang FRC Control System 18 16-03-2013 15:46
Cannot Download Code mandalorethx C/C++ 5 15-01-2010 12:44
Cannot get Code to Download to cRIO greekgod8591 C/C++ 25 09-03-2009 22:10
Cannot Download Code to our Robot jcvd C/C++ 9 27-01-2009 13:09


All times are GMT -5. The time now is 13:49.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi