- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello!
I am new in quartus 11 and NIOS II IDE 11sp1 for development. The project concludes four source files. the main() function is in my_file_for_blank_project_0.cpp the other three source files all have their corsponding H files included in my_file_for_blank_project_0.cpp. But when I build project, the console shows : **** Build of configuration Debug for project my_blank_project_0 **** make -s all includes Compiling file_sys.c... Compiling hal.c... Compiling host.c... Compiling my_file_for_blank_project_0.cpp... Linking my_blank_project_0.elf... obj/my_file_for_blank_project_0.o(.text+0x1c4): In function `main': ../my_file_for_blank_project_0.cpp:46: undefined reference to `host()' collect2: ld returned 1 exit status make: *** [my_blank_project_0.elf] Error 1 the host() function is in host.c and also declared in host.h. the corresponding four *.o files can also be produced. I do not know how to solve it. Can anyone with kindness help me?Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this happens because your are mixing C and C++ source files.
For example, If you want to call C++ code from a C source file you need the following definition in .cpp file: extern "C" int test_cpp_call (int n); int test_cpp_call (int n) { .... }
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page