Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

C compiles, C++ doesn't

I'm running the Nios II IDE in Windows. I can compile and run the supplied "Hello, world". If I change the file extension to .cpp or .cxx, I get:

*** no rule to make target `../hello_world.c', needed by `obj/hello_world.o'

If I change the extension from .c to .c, I get a dialogue box with:

no valid design files found. project hello_world_0 must contain design files

and the "detailed" explanation reads:

no valid design files found. project hello_world_0 must contain design files

Any ideas? I don't need the compilation type to be automatic, so it's OK either to fix this fault or force it to compile for C++.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Instead of renaming the file try adding a new file (e.g. test.cpp). Add some C++ code to make sure it really compiles as C++. Then get rid of hello_world.c and add the main() function to your new C++ file.

    I think the problem is that once a rule for hello_world.o has been established it's linked to hello_world.c. You may be able to add hello_world.cpp back in after deleting hello_world.c but it's not likely you even want a source file with that name.

    Andrew
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks, Andrew. That seems to be the explanation.

    Already I have a bad feeling about this IDE. If something like this fails, there will be trouble ahead.