Linking two .cpp and a .h files

后端 未结 8 894
小蘑菇
小蘑菇 2021-02-02 01:00

I\'m doing an exercise (from the third chapter of Thinking in C++) but I have a problem linking two .cpp files.

This is the exercise:

Create a h

相关标签:
8条回答
  • 2021-02-02 02:01

    For those like me who may be using the IDE BloodShed Dev C++.

    Create a project folder then proceed to place your H files and your CPP files inside your project folder.

    I had the same problem as mentioned above, the conclusion I came upon was that my compiler was only compiling the H files and wouldn't even read the CPP files linked to it. When I put them in a project folder my compiler would compile all files together hence allowing my code to run.

    Here is a link of creating a project folder for those using Bloodshed.

    http://www.horstmann.com/bigcpp/help/bloodshed/index.html

    As for other IDE users, I believe the problem to be similar. IF anyone needs further elaboration just let me know.

    0 讨论(0)
  • 2021-02-02 02:06

    I think you should have #include"func_x.cpp" in your func_main.cpp

    0 讨论(0)
提交回复
热议问题